调整devtools

This commit is contained in:
许彦峰
2019-03-16 15:02:45 +08:00
parent b0ceb078b9
commit e5b61e8676
11 changed files with 124 additions and 89 deletions

View File

@@ -1,9 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Dev</title>
</head>
<body>
</body>
</html>

View File

@@ -1,52 +0,0 @@
// 检查游戏是否为cocos游戏
// var cc={};
// if (typeof cc === "undefined") {
// console.log("该html不是cocos游戏,无法调试!");
// chrome.devtools.panels.elements.createSidebarPane("Creator Properties", function (sidebar) {
// // console.log("[Cocos Creator Inspector] CreateSidebarPane");
// // sidebar.setObject({ some_data: "Some data to show" });
// sidebar.setPage("devNoGame.html");
// });
// chrome.devtools.panels.create(
// "Cocos",
// "static/images/icon48.png",
// "devNoGame.html", function (panel) {
// // console.log("[Cocos Creator Inspector] Dev Panel Created!");
// });
//
// } else {
//
// }
chrome.devtools.panels.elements.createSidebarPane('My SliderBar', function (sidebar) {
sidebar.setObject({some_data: "some data to show!"});
});
chrome.devtools.panels.create(
"Cocos",
"static/images/icon48.png",
"devInspector.html",
function (panel) {
console.log("[Cocos Creator Inspector] Dev Panel Created!");
panel.onShown.addListener(function (window) {
console.log("panel show");
});
panel.onHidden.addListener(function (window) {
console.log("panel hide");
});
panel.onSearch.addListener(function (action, query) {
console.log("panel search!");
return false;
});
}
);
// (function () {
// var t = window.setInterval(function () {
// egret && egret.devtool &&
// egret.devtool.start &&
// (window.clearInterval(t) || egret.devtool.start());
// console.log("waiting")
// }, 100);
// egret && egret.devtool && egret.devtool.start && (window.clearInterval(t) || egret.devtool.start());
// })();

View File

@@ -0,0 +1,12 @@
import Vue from 'vue';
import dev_panel from './dev_panel.vue';
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI);
new Vue({
el: '#app',
render: h => h(dev_panel)
});

View File

@@ -0,0 +1,20 @@
<template>
<div>
<el-button @click="onClick">devtools</el-button>
</div>
</template>
<script>
export default {
name: "index",
methods: {
onClick() {
console.log("devtools");
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,51 @@
// 检查游戏是否为cocos游戏
// var cc={};
// if (typeof cc === "undefined") {
// console.log("该html不是cocos游戏,无法调试!");
// chrome.devtools.panels.elements.createSidebarPane("Creator Properties", function (sidebar) {
// // console.log("[Cocos Creator Inspector] CreateSidebarPane");
// // sidebar.setObject({ some_data: "Some data to show" });
// sidebar.setPage("devNoGame.html");
// });
// chrome.devtools.panels.create(
// "Cocos",
// "static/images/icon48.png",
// "devNoGame.html", function (panel) {
// // console.log("[Cocos Creator Inspector] Dev Panel Created!");
// });
//
// } else {
//
// }
// chrome.devtools.panels.elements.createSidebarPane('My SliderBar', function (sidebar) {
// sidebar.setObject({some_data: "some data to show!"});
// });
chrome.devtools.panels.create("Cocos", "icon/icon48.png", "pages/dev_panel.html",
function (panel) {
console.log("[Cocos Creator Inspector] Dev Panel Created!");
panel.onShown.addListener(function (window) {
console.log("panel show");
});
panel.onHidden.addListener(function (window) {
console.log("panel hide");
});
panel.onSearch.addListener(function (action, query) {
console.log("panel search!");
return false;
});
}
);
// (function () {
// var t = window.setInterval(function () {
// egret && egret.devtool &&
// egret.devtool.start &&
// (window.clearInterval(t) || egret.devtool.start());
// console.log("waiting")
// }, 100);
// egret && egret.devtool && egret.devtool.start && (window.clearInterval(t) || egret.devtool.start());
// })();

View File

@@ -0,0 +1,12 @@
let index = 0;
setInterval(function () {
let msg = "util: " + index++;
// chrome.extension.sendMessage(msg;
if (typeof aa !== undefined) {
msg = aa;
}
window.postMessage({type: 1, msg: msg}, '*');
}.bind(this), 2000);