Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Google Closure Library loader bookmarklet
// Enumerate your own list of goog.require:s, if you want something else than TableSorter and XhrIo.
// Similarly, you can pass a callback that will get the library in its first parameter, once loaded,
// or leave it as is, if you'd rather overwrite the top window's "goog" with your own custom version.
javascript:(function(requires, callback) {
var base = ''
, iframe = document.body.appendChild(document.createElement('iframe'));
iframe.src = 'about:blank'; = 'none';
iframe.contentWindow.cb = callback;
iframe.contentDocument.write('<head><script src="'+ base +'base.js"></script><script src="'+ base +
'deps.js"></script><script>'+JSON.stringify(requires)+'.forEach(goog.require);</script><script>' +
(callback ? ', goog)' : ' = goog') + ';</script></head><body></body>');
})(['goog.ui.TableSorter','']/*, function optional(goog){alert(}*/);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.