Skip to content

Instantly share code, notes, and snippets.

@sghiassy
Created September 25, 2015 09:14
Show Gist options
  • Select an option

  • Save sghiassy/43c25dbc6382f950277a to your computer and use it in GitHub Desktop.

Select an option

Save sghiassy/43c25dbc6382f950277a to your computer and use it in GitHub Desktop.
executeApplicationScript: function(message, sendReply) {
for (var key in message.inject) {
window[key] = JSON.parse(message.inject[key]);
}
loadScript(message.url, sendReply.bind(null, null));
}
function loadScript(src, callback) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
script.onload = callback;
document.head.appendChild(script);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment