How to import service classes into Mozilla WebExtensions

0
I'm migrating an addon from mozilla. (Migrating from ADDONS-SDK to WebExtensions technology, but I'm having trouble importing the main API classes.

When the plugin was made with ADDON-SDK, the import was done like this:

//Import das principais libs da SDK para usar no projeto
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
var utils = require('sdk/window/utils');

const {Cc,Ci,Cu} = require("chrome");
const Ac = console;

//Carregamento dos services    
const OS = Cc['@mozilla.org/observer-service;1'].getService(Ci.nsIObserverService);
const LOADER = Cc['@mozilla.org/moz/jssubscript-loader;1'].getService(Ci.mozIJSSubScriptLoader);
const IOS = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);

//import de arquivos de configuração do navegador
Cu.import("resource://gre/modules/Services.jsm");

//Carregamento de outros arquivos do projeto
LOADER.loadSubScript('chrome://vigiamcviewer/content/HTTP.js');

However, in WebExtensions, I did not find anything similar to doing imports.

I've browsed the API and found a good example of the SDK, but nothing to do with the WebExtensions.

    
asked by anonymous 25.01.2018 / 12:55

0 answers