diff --git a/src/js/resources/proxy-apply.js b/src/js/resources/proxy-apply.js index 60326f546..5fc6d7e55 100644 --- a/src/js/resources/proxy-apply.js +++ b/src/js/resources/proxy-apply.js @@ -85,6 +85,10 @@ export function proxyApplyFn( : new proxyApplyFn.ApplyContext(...args); } }; + proxyApplyFn.isCtor = new Map(); + } + if ( proxyApplyFn.isCtor.has(target) === false ) { + proxyApplyFn.isCtor.set(target, fn.prototype?.constructor === fn); } const fnStr = fn.toString(); const toString = (function toString() { return fnStr; }).bind(null); @@ -97,7 +101,7 @@ export function proxyApplyFn( return Reflect.get(target, prop); }, }; - if ( fn.prototype?.constructor === fn ) { + if ( proxyApplyFn.isCtor.get(target) ) { proxyDetails.construct = function(target, args) { return handler(proxyApplyFn.CtorContext.factory(target, args)); };