Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Using the Firefox add on code from a bootstrap add on

Richard Newman edited this page Dec 29, 2016 · 1 revision

Thanks to @chrmod for this in #144:

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;
}