From 2d0d1c32844ee10fa84785cec4d89eac76269151 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Thu, 29 Dec 2016 13:27:44 -0800 Subject: [PATCH] Created Using the Firefox add-on code from a bootstrap add-on (markdown) --- ...fox-add-on-code-from-a-bootstrap-add-on.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Using-the-Firefox-add-on-code-from-a-bootstrap-add-on.md diff --git a/Using-the-Firefox-add-on-code-from-a-bootstrap-add-on.md b/Using-the-Firefox-add-on-code-from-a-bootstrap-add-on.md new file mode 100644 index 0000000..dd0faef --- /dev/null +++ b/Using-the-Firefox-add-on-code-from-a-bootstrap-add-on.md @@ -0,0 +1,27 @@ +Thanks to @chrmod for this in #144: + +```javascript +function loadDatomish() { + var global = { + datomish: null, + require: function (moduleName) { + var module; + switch (moduleName) { + case 'chrome': + module = { + Components, + }; + break; + case 'sdk/timers': + module = { + setTimeout, + } + break; + } + return module; + } + }; + Services.scriptloader.loadSubScript("path-to/datomish.js", global); + return global.datomish; +} +``` \ No newline at end of file