本文整理匯總了TypeScript中sdk/simple-prefs.on函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript on函數的具體用法?TypeScript on怎麽用?TypeScript on使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了on函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor() {
this._packages = [];
this._modifiers = [
new ModifierCommand('tab', 'Executes next command in new tab.'),
new ModifierCommand('bgtab', 'Executes next command in new tab opened in background.')
];
this.loadCommands();
preferences.on('commands', () => this.openCommandsPage());
}
示例2: constructor
constructor() {
let theme = preferences.prefs['theme'];
let styleFile = theme == 0 ? './light.css' : './dark.css';
this._panel = Panel({
contentURL: './launcher/launcher.html',
contentScriptFile: [
'./libs/react.js',
'./libs/react-dom.js',
'./launcher/launcher.js',
],
contentStyleFile: styleFile,
width: 550,
height: 280,
position: { top: -5 },
onShow: () => this.onShow()
});
this.initHotkey();
preferences.on('hotkey', () => this.initHotkey());
}
示例3: Function
selection.on("select", () => {
console.log(selection.text);
selection.html = "<h1>Hello There!</h1>";
if (selection.isContiguous) {
console.log("selection is not not contiguous");
}
});
import * as self from "sdk/self";
p.contentScriptFile = self.data.url("./hello.js");
p.show();
import * as prefs from "sdk/simple-prefs";
type prefType = {pref1: string};
(prefs.prefs as prefType)["pref1"] = "value";
prefs.on("pref1", () => console.log("pref1 changed"));
prefs.removeListener("pref1", new Function());
import * as storage from "sdk/simple-storage";
storage.storage.value = 10;
storage.storage.x = "hello";
delete storage.storage.value;
storage.on("OverQuota", () => {
if (storage.quotaUsage > 1) {
console.log("you no longer have shelves to store anything. Successful!");
}
});
import * as system from "sdk/system";
console.log(system.env.PATH);
system.env.PATH = "/path/to/my/virus";