24 lines
518 B
TypeScript
Raw Normal View History

2021-11-12 21:20:57 +08:00
declare const cc: any;
export function isVersion3() {
2021-11-09 15:24:10 +08:00
if (typeof cc.ENGINE_VERSION === "string") {
const version: string = cc.ENGINE_VERSION;
return version.startsWith("3.")
}
return false;
}
2021-11-12 21:20:57 +08:00
export function isHasProperty(base: Object, key: string): boolean {
let ret = Object.getOwnPropertyDescriptor(base, key)
if (ret) {
return true;
} else {
let proto = Object.getPrototypeOf(base);
if (proto) {
return isHasProperty(proto, key)
} else {
return false;
}
}
}