Created
November 5, 2014 22:32
-
-
Save lkuper/92eaf7d7db11700977a1 to your computer and use it in GitHub Desktop.
This file contains 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
// Extension-side code | |
let AnObj = { | |
field: "hello", | |
thisIsATest: function() { | |
let str = this.field + " world!"; | |
return str; | |
}, | |
}; | |
let thisIsATestBound = AnObj.thisIsATest.bind(AnObj); | |
Components.utils.exportFunction(AnObj.thisIsATest, window, | |
{defineAs: "thisIsATest"}); | |
Components.utils.exportFunction(thisIsATestBound, window, | |
{defineAs: "thisIsATestBound"}); | |
// User-side code | |
console.log(thisIsATest()); // "undefined world!" | |
console.log(thisIsATestBound()); // "hello world!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment