项目环境配置

This commit is contained in:
xuyanfeng
2021-04-03 16:14:37 +08:00
parent 3f60e58c71
commit 820ce75422
12 changed files with 263 additions and 79 deletions

View File

@@ -3,6 +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')
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')
@@ -28,7 +29,7 @@ function longConnectionLink(data: any, sender: any) {
}
// 长连接
chrome.runtime.onConnect.addListener(function (port) {
chrome.runtime.onConnect.addListener((port) => {
console.log(`%c[长连接:${port.name}] 建立链接!`, "background:#aaa;color:#ff0000");
port.onMessage.addListener(longConnectionLink);
port.onDisconnect.addListener(function (port) {

View File

@@ -1,4 +1,9 @@
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!"});

View File

@@ -3,7 +3,6 @@
"version": "1.1.0",
"name": "Cocos Creator Inspector",
"description": "Cocos Creator Inspector",
"default_locale": "en",
"permissions": [
"activeTab",
"<all_urls>",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -1,54 +0,0 @@
module.exports = {
name: "Cocos Creator Inspector",
version: "1.0.1",
description: "Cocos Creator Inspector",
browser_action: {
default_title: "CC-Inspector",
default_icon: "icon/icon48.png",
default_popup: "popup.html"
},
icons: {
48: "icon/icon48.png"
},
devtools_page: "devtools_panel.html",
content_scripts: [
{
matches: ["<all_urls>"],
js: ["js/content.js"],
run_at: "document_end",
all_frames: true
}
],
background: {
scripts: ["js/background.js"],
persistent: false,// 需要时开启
},
// optionsV1的写法
options_page: "options.html",
// optionsV2的写法
options_ui: {
page: "options.html",
// 添加一些默认的样式,推荐使用
chrome_style: true,
},
manifest_version: 2,
permissions: [
"tabs",
"http://*/*",
"https://*/*",
"*://*/*",
"audio",
"system.cpu",
"clipboardRead",
"clipboardWrite",
"system.memory",
"processes",// 这个权限只在chrome-dev版本都才有
"tabs",
"storage",
"nativeMessaging",
"contextMenus",
"notifications",
],
web_accessible_resources: ["*/*", "*"],
content_security_policy: "script-src 'self' 'unsafe-eval'; object-src 'self'"
}

View File

@@ -42,6 +42,7 @@
<script lang="ts">
import {Component, Vue} from "vue-property-decorator";
import HelloWorld from "./HelloWorld.vue";
import Manifest from '../manifest.json'
@Component({
components: {
@@ -68,9 +69,9 @@ export default class App extends Vue {
onClickOptions() {
if (chrome && chrome.tabs) {
const manifest = require('../manifest/index')
if (manifest.options_page) {
chrome.tabs.create({url: manifest.options_page})
let {page} = Manifest.options_ui;
if (page) {
chrome.tabs.create({url: page})
}
}
}