本文整理汇总了TypeScript中chrome.Cu类的典型用法代码示例。如果您正苦于以下问题:TypeScript Cu类的具体用法?TypeScript Cu怎么用?TypeScript Cu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cu类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isObject
import {Cu} from 'chrome';
//console.log('typeof this.Reflect', typeof this.Reflect);
const Reflect = Cu.import("resource://gre/modules/reflect.jsm", {}).Reflect;
//console.log('typeof this.Reflect', typeof this.Reflect);
export default function getObjectCreationsLocations(src: string){
var root = Reflect.parse(src);
var result : Array<{
newObject?: SpiderMonkeyASTNode,
newEdge?: SpiderMonkeyASTNode
}> = [];
result.toString = function(){
return JSON.stringify(this, null, 3);
};
function isObject(x: any){
return Object(x) === x;
}
function traverse(node: SpiderMonkeyASTNode){
if(isObject(node) && ('type' in node || Array.isArray(node))){
if(node.type) console.log('node', node.type, node);
}
else{
return;
}
示例2: forceGC
function forceGC() {
Cu.forceGC();
os.notifyObservers(null, 'child-gc-request', null);
}
示例3: function
import {Cu} from 'chrome'
import {data} from 'sdk/self';
const {gDevTools} = Cu.import("resource://devtools/client/framework/gDevTools.jsm", {});
export default {
initialize: function (onGraph: (g: Graph<any, any>) => void) {
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))
};
gDevTools.on("toolbox-created", this.onToolboxCreated);
},
shutdown: function () {
gDevTools.off("toolbox-created", this.onToolboxCreated);
this.onToolboxCreated = undefined;
}
}