It has two modes of operation; if all you want to do is load the
goog
object into the current page (or overwrite the one you already have with one that has a different set of goog.require()
s), just customize which those requires should be, and you're set; it creates an iframe, in which it loads the library (goog.require
only works during page parsing time, as it uses document.write()
to load its dependencies), and then overwrites the top window's goog
identifier.The second mode is good for writing your own bookmarklets making use of some Closure Library tools; provide your own function, and it will instead get called with the freshly loaded
goog
object, once it's ready. At the moment, I have only played with this in Google Chrome, but feel free to fork away on github, if you tinker in additional improvements for other browsers.Finally, here's a bookmarklet version to save or play with, which will prompt you for just which closure dependencies you want to load: closure – drag it to your bookmarks toolbar or equivalent if you want to keep it around. Enjoy!