This file contains hidden or 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
| var am = require("sdk/preferences/utils"); | |
| var self = require("sdk/self"); | |
| // Open the add-on manager with the preference page for this add-on. | |
| am.open(self); | |
| // Returns a promise that resolves once the tab is open. |
This file contains hidden or 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
| function check() { | |
| // do whatever you want to do | |
| } | |
| // listen when to run again | |
| self.port.on("refresh", check); | |
| // run check when the script is attached | |
| check(); |
This file contains hidden or 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
| var events = require("sdk/system/events"); | |
| var {Ci} = require("chrome"); | |
| // See https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIPermissionManager | |
| function listener(event) { | |
| var permission; | |
| // Some events aren't specific to one permission and thus don't have a subject | |
| if(event.subject) | |
| permission = event.subject.QueryInterface(Ci.nsIPermission); |
This file contains hidden or 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
| // Ci is a shorthand for Components.interfaces that has to be defined beforehand. | |
| var enumerator; // is a nsISimpleEnumberator | |
| // Adjust the elementInterface to support your needs / what the enumerator actually provides. Feel free to hard code that instead of doing it this way. | |
| var element, elementInterface = "nsISupports"; | |
| while(enumerator.hasMoreElements()) { | |
| element = enumerator.getNext().QueryInterface(Ci[elementInterface]); | |
| // do stuff with element | |
| } |
This file contains hidden or 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
| //declare a promise to handle this treatement | |
| //would be nice to call the same code many times | |
| //use it as a function | |
| Task.spawn(function* () { | |
| //global variable | |
| let id=[]; | |
| let db = yield Sqlite.openConnection({ path: myPath}); | |
| try { | |
| let row = yield db.execute("SELECT id FROM 'plates'"); |
This file contains hidden or 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
| I/stdout (15148): console.log: jetpack-homepanel: 03dcc2ed-70a6-4fd2-99d5-ed2865f88f3f@jetpack-homepanel | |
| I/stdout (15148): console.log: jetpack-homepanel: After first yield 03dcc2ed-70a6-4fd2-99d5-ed2865f88f3f@jetpack-homepanel | |
| I/stdout (15148): console.log: jetpack-homepanel: After first yield 03dcc2ed-70a6-4fd2-99d5-ed2865f88f3f@jetpack-homepanel | |
| I/stdout (15148): console.log: jetpack-homepanel: Before save 47facd51-8e1b-48c6-8539-39c218bec856@jetpack-homepanel |
This file contains hidden or 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
| // This removes the need to import Ci and the XPCOMUtils | |
| const { Class } = require("sdk/core/heritage"); | |
| const { Unknown } = require('sdk/platform/xpcom'); | |
| let bmListener = Class({ | |
| extends: Unknown, | |
| interfaces: [ "nsINavBookmarkObserver" ], | |
| //this one will take care of everything since other events are buggy or bad logic | |
| onItemChanged: function(bId, prop, an, nV, lM, type, parentId, aGUID) { | |
| //console.log("onItemChanged", "bId: "+bId, "property: "+prop, "isAnno: "+an, "new value: "+nV, "lastMod: "+lM, "type: "+type, "parentId:"+parentId, "aGUID:"+aGUID); |
This file contains hidden or 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
| search_button_label=Suchen | |
| search_button_tooltiptext=Durchsucht die Inhalte der Adressleiste, Auswahl und Zwischenablage. | |
| urlbarMode_title=Adressleistenverhalten | |
| urlbarMode_description=Interaktion der Adressleiste mit Fokus. Fix: Feste Größe, Wachsend: Wird größer wenn fokussiert, Flexibel: Nutzt allen von Tabs ungenutzten Platz. | |
| urlbarMode_options.Fixed=Fix | |
| urlbarMode_options.Sliding=Wachsend | |
| urlbarMode_options.Flexible=Flexibel | |
| urlbarBlur_title=Adressleistenbreite wenn nicht fokussiert |
This file contains hidden or 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
| const { CC, Cc,Ci } = require("chrome"); | |
| // Open a socket for listening for incoming connections (server) | |
| const ServerSocket = CC("@mozilla.org/network/server-socket;1", "nsIServerSocket"); | |
| var openSocket = (port, loopBack) => { | |
| let ss = new ServerSocket(); | |
| // start the socket | |
| ss.init(port, loopBack, -1); | |
| // start listening for connections |