Created
October 9, 2012 21:50
-
-
Save jeffgca/3861675 to your computer and use it in GitHub Desktop.
content script apis ideas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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() {} | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/3864791