Skip to content

Instantly share code, notes, and snippets.

@jeffgca
Created October 9, 2012 21:50
Show Gist options
  • Select an option

  • Save jeffgca/3861675 to your computer and use it in GitHub Desktop.

Select an option

Save jeffgca/3861675 to your computer and use it in GitHub Desktop.
content script apis ideas
/**
* expanded content script globals, eg 'aliasing' or
* bridging some high-level apis into content scripts
*
* ... may need to get rid of unsafeWindow...
*/
$(function() {
// what we have now
self.on('event-name', function(data) {
// ... something
});
self.port.emit('something');
// instead, implement 'add-on' global for the sandbox?
addon.notify({
title: 'foo',
text: 'bar',
data: 'baz baz',
onClick: function() {}
}); // callback?
addon.panels['panel-name'].show();
addon.request({
url: 'http://something.ca',
/// ...
onComplete: function(response) {
// response data is brought back serialized.
}
})
/*
* the 'require' case, perhaps we have an abstract 'bridge'
* protocol that a module can implement, which handles communication?
*/
self.require('notifications').notify({
title: 'foo',
text: 'bar',
data: 'baz baz',
onClick: function() {}
});
});
@Gozala
Copy link

Gozala commented Oct 10, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment