Last active
August 29, 2015 14:13
-
-
Save autonome/982dda5509122f733846 to your computer and use it in GitHub Desktop.
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
/chrome.manifest: | |
component {a5d89cee-85f4-44ad-b8eb-39ad39170823} components/helloworldapi.js | |
contract @mozilla.org/helloworld;1 {a5d89cee-85f4-44ad-b8eb-39ad39170823} | |
category JavaScript-navigator-property helloworld @mozilla.org/helloworld;1 | |
/components/helloworldapi.js: | |
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); | |
function helloWorld() { | |
this.wrappedJSObject = this; | |
} | |
helloWorld.prototype = { | |
// this must match whatever is in chrome.manifest! | |
classID: Components.ID("{a5d89cee-85f4-44ad-b8eb-39ad39170823}"), | |
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]), | |
hello: function() { | |
return "Hello World!"; | |
} | |
}; | |
// The following line is what XPCOM uses to create components. Each component prototype | |
// must have a .classID which is used to create it. | |
const NSGetFactory = XPCOMUtils.generateNSGetFactory([helloWorld]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment