@visactor/vrender-animate
Version:
This module provides a graph-based animation system for VRender.
15 lines (14 loc) • 613 B
JavaScript
import { isFunction } from "@visactor/vutils";
export function getCustomType(custom) {
if (!custom || !isFunction(custom)) return 0;
const functionStr = Function.prototype.toString.call(custom);
if (/^class\s/.test(functionStr)) return 1;
if (!custom.prototype) return 2;
if (custom.prototype.constructor === custom) {
const descriptor = Object.getOwnPropertyDescriptor(custom, "prototype");
if (descriptor && !descriptor.writable) return 1;
if (Object.getOwnPropertyNames(custom.prototype).length > 1) return 1;
}
return 2;
}
//# sourceMappingURL=utils.js.map