1 Using the Firefox add on code from a bootstrap add on
Richard Newman edited this page 2016-12-29 13:27:44 -08:00

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