[jQuery] Extending global in plugin

[jQuery] Extending global in plugin


I'd like to write a plugin that:
1) creates and populates some new elements on the page based on some
data passed to an initialize function.
2) does regular plugin-y things like $("#element").myCustomMethod({foo:
1, bar:"hi"});
I understand how to do #2, and there's lots of good instructions for
writing plugins that do that. But what's the right pattern for also
doing #1? Ideally I'd like to write something like:
$.myNewFeature(initializeOptions);
In particular, what's the right pattern for providing default values
for that initialization step? (And if there's an entirely different
better way to do this, please let me know.)