diff --git a/NativeScript/runtime/WeakRef.cpp b/NativeScript/runtime/WeakRef.cpp index d9601338..adff449f 100644 --- a/NativeScript/runtime/WeakRef.cpp +++ b/NativeScript/runtime/WeakRef.cpp @@ -9,8 +9,13 @@ void WeakRef::Init(Local context) { Isolate* isolate = context->GetIsolate(); std::string source = R"( - global.WeakRef.prototype.get = global.WeakRef.prototype.deref; + global.WeakRef.prototype.get = global.WeakRef.prototype.deref; + global.WeakRef.prototype.__hasWarnedAboutClear = false; global.WeakRef.prototype.clear = () => { + if(global.WeakRef.prototype.__hasWarnedAboutClear) { + return; + } + global.WeakRef.prototype.__hasWarnedAboutClear = true; console.warn('WeakRef.clear() is non-standard and has been deprecated. It does nothing and the call can be safely removed.'); } )";