mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-16 07:01:03 +00:00
修复warning过多的问题
This commit is contained in:
parent
6dc523bf9f
commit
7382afc602
@ -313,7 +313,10 @@ export class Inspector extends InjectEvent {
|
|||||||
|
|
||||||
allKeys = allKeys.filter((key) => {
|
allKeys = allKeys.filter((key) => {
|
||||||
try {
|
try {
|
||||||
return typeof node[key] !== "function";
|
this.warnSilent(true);
|
||||||
|
const type = typeof node[key];
|
||||||
|
this.warnSilent(false);
|
||||||
|
return type !== "function";
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// console.warn(`属性${key}出现异常:\n`, e);
|
// console.warn(`属性${key}出现异常:\n`, e);
|
||||||
return false;
|
return false;
|
||||||
@ -405,9 +408,19 @@ export class Inspector extends InjectEvent {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
private warnSilent(v: boolean) {
|
||||||
|
if (typeof cc !== undefined && typeof cc.warn === "function") {
|
||||||
|
if (v) {
|
||||||
|
cc.warn = () => {};
|
||||||
|
} else {
|
||||||
|
cc.warn = console.warn.bind(console);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_genInfoData(node: any, key: string | number, path: Array<string>): Info | null {
|
_genInfoData(node: any, key: string | number, path: Array<string>): Info | null {
|
||||||
|
this.warnSilent(true);
|
||||||
const propertyValue = node[key];
|
const propertyValue = node[key];
|
||||||
|
this.warnSilent(false);
|
||||||
const make = (info: Info | null) => {
|
const make = (info: Info | null) => {
|
||||||
info.readonly = this._isReadonly(node, key);
|
info.readonly = this._isReadonly(node, key);
|
||||||
info.path = path;
|
info.path = path;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user