当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript tabs.open函数代码示例

本文整理汇总了TypeScript中sdk/tabs.open函数的典型用法代码示例。如果您正苦于以下问题:TypeScript open函数的具体用法?TypeScript open怎么用?TypeScript open使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了open函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: openCommandsPage

	private openCommandsPage() {
		let collection = this;
		Tabs.open({
            url: self.data.url('./configuration/commands.html'),
            onReady: function (tab : FFTab) {
                var worker = tab.attach({
                    contentScriptFile: [
                        './libs/react.js',
                        './libs/react-dom.js',
                        './configuration/commands.js'],
                    contentScriptOptions: { commands: storage.storage.commandStore }
                });
					worker.port.on('save', (commands : string) => collection.saveCommands(commands));
            }
        });
	}
开发者ID:dstarkowski,项目名称:sp-mouseless,代码行数:16,代码来源:commandCollection.ts

示例2: function

 onClick: function (state) {
     tabs.open({
         url: "http://www.youku.com/",
         isPrivate: true
     });
 }
开发者ID:xiamubobby,项目名称:ffside,代码行数:6,代码来源:index2.ts

示例3:

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";

import * as tabs from "sdk/tabs";
tabs.open({url: "http://example.com", onOpen: (tab) => tab.close()});
tabs.open("http://example.com");
console.info(tabs.length);

import * as timers from "sdk/timers";
timers.clearTimeout(timers.setInterval(() => console.log("hello"), 100));
timers.clearInterval(timers.setTimeout(() => console.log("hello again"), 100));

import * as action from "sdk/ui/button/action";
let button = action.ActionButton({id: "my button", label: "my button", icon: "./myicon.png"});
button.on("click", (state) => {
  if (state.label == "destroy") {
    button.destroy();
  }
});
开发者ID:1drop,项目名称:DefinitelyTyped,代码行数:30,代码来源:jpm-tests.ts


注:本文中的sdk/tabs.open函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。