mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-20 08:58:41 +00:00
配置devtools
This commit is contained in:
parent
820ce75422
commit
0959012124
@ -3,7 +3,7 @@ import * as PluginMsg from "./core/plugin-msg"
|
||||
let Devtools: chrome.runtime.Port | null = null;
|
||||
let DevtoolsPanel: chrome.runtime.Port | null = null;
|
||||
let Content: chrome.runtime.Port | null = null;
|
||||
console.error('on background')
|
||||
console.log('on background')
|
||||
|
||||
function shortConnectionLink(request: any, sender: any, sendResponse: any) {
|
||||
// console.log(`%c[短连接|id:${sender.id}|url:${sender.url}]\n${JSON.stringify(request)}`, 'background:#aaa;color:#BD4E19')
|
||||
@ -90,7 +90,7 @@ function createPluginMenus() {
|
||||
} else if (info.menuItemId === "notify") {
|
||||
chrome.notifications.create("null", {
|
||||
type: "basic",
|
||||
iconUrl: "icon/icon48.png",
|
||||
iconUrl: "icons/48.png",
|
||||
title: "通知",
|
||||
message: "测试通知",
|
||||
})
|
||||
|
@ -1 +1 @@
|
||||
console.log('11')
|
||||
console.log('content code')
|
||||
|
@ -2,8 +2,9 @@ import Vue from "vue";
|
||||
import ElementUI from "element-ui"
|
||||
import "element-ui/lib/theme-chalk/index.css"
|
||||
import index from "./index.vue";
|
||||
import './register-panel';
|
||||
|
||||
Vue.use(ElementUI);
|
||||
Vue.use(ElementUI, {size: "mini"});
|
||||
new Vue({
|
||||
el: "#app",
|
||||
render: h => h(index)
|
@ -48,7 +48,7 @@
|
||||
// import EvalCode from "./evalCodeString.js";
|
||||
|
||||
|
||||
const PluginMsg = require("../../core/plugin-msg");
|
||||
const PluginMsg = require("../core/plugin-msg");
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -329,7 +329,7 @@
|
||||
},
|
||||
onBtnClickTest3() {
|
||||
// chrome.devtools.inspectedWindow.eval(`window.ccinspector.testMsg3()`)
|
||||
let f = require("../../core/event-mgr");
|
||||
let f = require("../core/event-mgr");
|
||||
console.log(f.id);
|
||||
},
|
||||
onMemoryTest() {
|
@ -1,31 +0,0 @@
|
||||
import * as PluginMsg from '../core/plugin-msg'
|
||||
console.log('on devtools')
|
||||
debugger
|
||||
import Manifest from '../manifest.json'
|
||||
Manifest.devtools_page
|
||||
|
||||
// 对应的是Elements面板的边栏
|
||||
chrome.devtools.panels.elements.createSidebarPane('Cocos', function (sidebar) {
|
||||
sidebar.setObject({some_data: "some data to show!"});
|
||||
});
|
||||
// 创建devtools-panel
|
||||
chrome.devtools.panels.create("Cocos", "icon/icon48.png", "pages/devtools_panel.html", function (panel: chrome.devtools.panels.ExtensionPanel) {
|
||||
console.log("[CC-Inspector] Dev Panel Created!");
|
||||
let conn = chrome.runtime.connect({name: PluginMsg.Page.DevToolsPanel});
|
||||
conn.onMessage.addListener(function (event, sender) {
|
||||
// debugger
|
||||
});
|
||||
|
||||
panel.onShown.addListener((window) => {
|
||||
console.log("panel show");
|
||||
conn.postMessage({msg: PluginMsg.Msg.UrlChange, data: {}})
|
||||
});
|
||||
panel.onHidden.addListener(() => {
|
||||
console.log("panel hide");
|
||||
});
|
||||
panel.onSearch.addListener(function (action, query) {
|
||||
console.log("panel search!");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
33
source/src/devtools/register-panel.ts
Normal file
33
source/src/devtools/register-panel.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import * as PluginMsg from '../core/plugin-msg'
|
||||
import Manifest from '../manifest.json'
|
||||
|
||||
|
||||
if (chrome && chrome.devtools) {
|
||||
// 对应的是Elements面板的边栏
|
||||
chrome.devtools.panels.elements.createSidebarPane('Cocos', function (sidebar) {
|
||||
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!");
|
||||
let conn = chrome.runtime.connect({name: PluginMsg.Page.DevToolsPanel});
|
||||
conn.onMessage.addListener(function (event, sender) {
|
||||
// debugger
|
||||
});
|
||||
|
||||
panel.onShown.addListener((window) => {
|
||||
console.log("panel show");
|
||||
conn.postMessage({msg: PluginMsg.Msg.UrlChange, data: {}})
|
||||
});
|
||||
panel.onHidden.addListener(() => {
|
||||
console.log("panel hide");
|
||||
});
|
||||
panel.onSearch.addListener(function (action, query) {
|
||||
console.log("panel search!");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
"icons": {
|
||||
"48": "icons/48.png"
|
||||
},
|
||||
"devtools_page": "devtools_panel.html",
|
||||
"devtools_page": "devtools.html",
|
||||
"background": {
|
||||
"scripts": [
|
||||
"js/background.js"
|
||||
|
@ -4,21 +4,14 @@ module.exports = {
|
||||
publicPath: "/",
|
||||
outputDir: "dist",
|
||||
pages: {
|
||||
popup: {
|
||||
entry: "src/popup/index.ts",
|
||||
template: "public/index.html",
|
||||
filename: "popup.html",
|
||||
title: "popup",
|
||||
},
|
||||
popup: "src/popup/index.ts",
|
||||
options: "src/options/index.ts",
|
||||
devtools_panel: "src/devtools/panel/index.ts",
|
||||
test: "src/test/index.ts",
|
||||
devtools: "src/devtools/index.ts",
|
||||
},
|
||||
pluginOptions: {
|
||||
browserExtension: {
|
||||
components: {
|
||||
background: true,
|
||||
devtools: true,
|
||||
contentScripts: true,
|
||||
},
|
||||
componentOptions: {
|
||||
@ -29,29 +22,8 @@ module.exports = {
|
||||
},
|
||||
background: {
|
||||
entry: "src/background.ts",
|
||||
},
|
||||
devtools: {
|
||||
entry: "src/devtools/main.ts",
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// configureWebpack: {
|
||||
// mode: "development",
|
||||
// devtool: "#source-map",
|
||||
// entry: {
|
||||
// content: Path.join(__dirname, "src/content.ts"),
|
||||
// background: Path.join(__dirname, "src/background.ts"),
|
||||
// inject: Path.join(__dirname, "src/inject.js"),
|
||||
// devtools: Path.join(__dirname, "src/devtools/main.ts"),
|
||||
// },
|
||||
// output: {
|
||||
// filename: "js/[name].js?t=[hash]"
|
||||
// },
|
||||
// plugins: [
|
||||
// new ChromeManifest({
|
||||
// manifest: Path.join(__dirname, "src/manifest/index.js")
|
||||
// }),
|
||||
// ]
|
||||
// }
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user