mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-12-14 06:38:45 +00:00
适配
This commit is contained in:
@@ -1,33 +1,31 @@
|
||||
import Manifest from '../manifest.json'
|
||||
import {connectBackground} from "@/devtools/connectBackground";
|
||||
import {PluginEvent, Msg, Page} from "@/core/types";
|
||||
import { ChromeConst } from "cc-plugin/src/chrome/const";
|
||||
import { connectBackground } from "./connectBackground";
|
||||
import { PluginEvent, Msg, Page } from "../../core/types";
|
||||
|
||||
export function init() {
|
||||
if (chrome && chrome.devtools) {
|
||||
if (chrome && chrome.devtools) {
|
||||
// 对应的是Elements面板的边栏
|
||||
chrome.devtools.panels.elements.createSidebarPane('Cocos', function (sidebar) {
|
||||
sidebar.setObject({some_data: "some data to show!"});
|
||||
sidebar.setObject({ some_data: "some data to show!" });
|
||||
});
|
||||
|
||||
// 创建devtools-panel
|
||||
chrome.devtools.panels.create("Cocos", "icons/48.png", Manifest.devtools_page, (panel: chrome.devtools.panels.ExtensionPanel) => {
|
||||
console.log("[CC-Inspector] Dev Panel Created!");
|
||||
panel.onShown.addListener((window) => {
|
||||
// 面板显示,查询是否是cocos游戏
|
||||
console.log("panel show");
|
||||
// connectBackground.postMessageToBackground(Msg.Support, null)
|
||||
});
|
||||
panel.onHidden.addListener(() => {
|
||||
// 面板隐藏
|
||||
console.log("panel hide");
|
||||
});
|
||||
panel.onSearch.addListener(function (action, query) {
|
||||
// ctrl+f 查找触发
|
||||
console.log("panel search!");
|
||||
});
|
||||
}
|
||||
chrome.devtools.panels.create("Cocos", "icons/48.png", ChromeConst.html.devtools, (panel: chrome.devtools.panels.ExtensionPanel) => {
|
||||
console.log("[CC-Inspector] Dev Panel Created!");
|
||||
panel.onShown.addListener((window) => {
|
||||
// 面板显示,查询是否是cocos游戏
|
||||
console.log("panel show");
|
||||
// connectBackground.postMessageToBackground(Msg.Support, null)
|
||||
});
|
||||
panel.onHidden.addListener(() => {
|
||||
// 面板隐藏
|
||||
console.log("panel hide");
|
||||
});
|
||||
panel.onSearch.addListener(function (action, query) {
|
||||
// ctrl+f 查找触发
|
||||
console.log("panel search!");
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user