本文整理汇总了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";