當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。