2021-04-03 11:42:08 +08:00
|
|
|
import * as PluginMsg from '../core/plugin-msg'
|
2019-03-16 18:44:32 +08:00
|
|
|
// 对应的是Elements面板的边栏
|
|
|
|
chrome.devtools.panels.elements.createSidebarPane('Cocos', function (sidebar) {
|
|
|
|
sidebar.setObject({some_data: "some data to show!"});
|
|
|
|
});
|
|
|
|
// 创建devtools-panel
|
2021-04-03 11:42:08 +08:00
|
|
|
chrome.devtools.panels.create("Cocos", "icon/icon48.png", "pages/devtools_panel.html", function (panel: chrome.devtools.panels.ExtensionPanel) {
|
2019-03-16 18:44:32 +08:00
|
|
|
console.log("[CC-Inspector] Dev Panel Created!");
|
2019-03-18 18:03:07 +08:00
|
|
|
let conn = chrome.runtime.connect({name: PluginMsg.Page.DevToolsPanel});
|
|
|
|
conn.onMessage.addListener(function (event, sender) {
|
2019-04-16 10:34:34 +08:00
|
|
|
// debugger
|
2019-03-18 18:03:07 +08:00
|
|
|
});
|
|
|
|
|
2021-04-03 11:42:08 +08:00
|
|
|
panel.onShown.addListener((window) => {
|
2019-03-16 15:02:45 +08:00
|
|
|
console.log("panel show");
|
2019-03-18 18:03:07 +08:00
|
|
|
conn.postMessage({msg: PluginMsg.Msg.UrlChange, data: {}})
|
2019-03-16 15:02:45 +08:00
|
|
|
});
|
2021-04-03 11:42:08 +08:00
|
|
|
panel.onHidden.addListener(() => {
|
2019-03-16 15:02:45 +08:00
|
|
|
console.log("panel hide");
|
|
|
|
});
|
|
|
|
panel.onSearch.addListener(function (action, query) {
|
|
|
|
console.log("panel search!");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|