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


TypeScript self.data类代码示例

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


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

示例1: loadCommands

	private loadCommands() {
		if (storage.storage.commandStore == null) {
			storage.storage.commandStore = self.data.load('commands.json');
		}

		let json = JSON.parse(storage.storage.commandStore);
		this._version = json.version;

		for (let item of json.packages) {
			this._packages.push(new CommandPackage(item));
		}
	}
开发者ID:dstarkowski,项目名称:sp-mouseless,代码行数:12,代码来源:commandCollection.ts

示例2: 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

示例3: closeTab

        worker.port.emit("pageup", {});
    }
});


function closeTab(tab, message){
    console.log("chrome received message", message);
    console.log("closing tab", tab);
    tab.close();
}


pageMod.PageMod({
    include: ["http://*", "https://*"],
    contentStyleFile: "./style.css",
    contentScriptFile: [slf.data.url("jquery-1.11.3.min.js"), slf.data.url("content-script.js")],
    contentScriptWhen: "ready",
    onAttach: function(worker){
        if(!worker.tab){
            console.log("worker has no tab!", worker);
        }
        tabWorkers.set(worker.tab, worker);
        worker.port.on("keypress", (message : Message) => {
            const tab = tabs.activeTab;
            closeTab(tab, message);
        });

        worker.port.on("log", (message : LogMessage) => {
            const tabIndex = worker.tab ? worker.tab.index : -1;
            console.log("(tab", tabIndex, "):", ...message.json.contents);
        });
开发者ID:ChimeraCoder,项目名称:electrovim,代码行数:31,代码来源:index.ts

示例4: require

/**
 * Created by natsuki on 16/4/13.
 */
/// <reference path="data/modules/protos" />
var self = require("sdk/self");
var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");
var pageMod = require("sdk/page-mod");
var Request = require("sdk/request").Request;

console.log(self.data.url("configs.js"))

var button = buttons.ActionButton({
    id: "ikanicon",
    label: "Visit Me",
    icon: {
        "16": "./icon.png",
        "32": "./icon.png",
        "64": "./icon.png"
    },
    onClick: function (state) {
        tabs.open({
            url: "http://www.youku.com/",
            isPrivate: true
        });
    }
});

function withJQueryInjected(url) {
    var i = arguments.length
    var ret = []
开发者ID:xiamubobby,项目名称:ffside,代码行数:31,代码来源:index2.ts

示例5: Function

pageMod.PageMod({include: "http://example.com", onAttach: (worker) => privateBrowsing.isPrivate(worker)});

import * as requests from "sdk/request";
requests.Request<{value: string}>({url: "http://example.com", onComplete: (response) => console.log(response.json["value"])}).get();

import * as selection from "sdk/selection";
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!");
开发者ID:1drop,项目名称:DefinitelyTyped,代码行数:31,代码来源:jpm-tests.ts

示例6: addEndEvent

  addEndEvent(name: string, timeEnded: number) {
    this._markerEvents.push({ph: 'E', ts: timeEnded - this._profilerStartTime, name: name});
  }
}

function forceGC() {
  Cu.forceGC();
  os.notifyObservers(null, 'child-gc-request', null);
}

const mod = require('sdk/page-mod');
const data = require('sdk/self').data;
const profiler = new Profiler();
mod.PageMod({
  include: ['*'],
  contentScriptFile: data.url('installed_script.js'),
  onAttach: (worker: any) => {
    worker.port.on(
        'startProfiler',
        (timeStarted: any) => profiler.start(
            /* = profiler memory */ 3000000, 0.1, ['leaf', 'js', 'stackwalk', 'gc'], timeStarted));
    worker.port.on('stopProfiler', () => profiler.stop());
    worker.port.on(
        'getProfile', () => worker.port.emit('perfProfile', profiler.getProfilePerfEvents()));
    worker.port.on('forceGC', forceGC);
    worker.port.on(
        'markStart', (name: string, timeStarted: any) => profiler.addStartEvent(name, timeStarted));
    worker.port.on(
        'markEnd', (name: string, timeEnded: any) => profiler.addEndEvent(name, timeEnded));
  }
});
开发者ID:BobChao87,项目名称:angular,代码行数:31,代码来源:main.ts

示例7: Class

import {data} from 'sdk/self';
import {Panel} from 'dev/panel';
import {Class} from 'sdk/core/heritage';


/**
 * This object represents a new {@Toolbox} panel
 */
export default new Class({
    extends: Panel,

    label: "OoI",
    tooltip: "Object of Interest",
    icon: "./icon-16.png",
    url: data.url("./ooi-panel.html"),

    /**
     * Executed by the framework when an instance of this panel is created.
     * There is one instance of this panel per {@Toolbox}. The panel is
     * instantiated when selected in the toolbox for the first time.
     */
    initialize: function () {
    },

    /**
     * Executed by the framework when the panel is destroyed.
     */
    dispose: function () {
    },

    /**
开发者ID:DavidBruant,项目名称:OoI,代码行数:31,代码来源:OoIPanel.ts

示例8: function

        this.onToolboxCreated = function(e: any, toolbox: Toolbox) {
            var correspondingTabMM = toolbox.target.tab.linkedBrowser.frameLoader.messageManager;

            correspondingTabMM.loadFrameScript(data.url("tab-content-script.js"), false);
            correspondingTabMM.addMessageListener('graph', (m: MessageManagerMessage) => onGraph(m.data))
        };
开发者ID:DavidBruant,项目名称:OoI,代码行数:6,代码来源:devtoolsHooks.ts


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