當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript simple-prefs.on函數代碼示例

本文整理匯總了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());
	}
開發者ID:dstarkowski,項目名稱:sp-mouseless,代碼行數:11,代碼來源:commandCollection.ts

示例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());
	}
開發者ID:dstarkowski,項目名稱:sp-mouseless,代碼行數:21,代碼來源:launcherPanel.ts

示例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";
開發者ID:1drop,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:jpm-tests.ts


注:本文中的sdk/simple-prefs.on函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。