当前位置: 首页>>代码示例>>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;未经允许,请勿转载。