@nativescript/android
Advanced tools
Comparing version 8.9.0-napi-jsc.6 to 8.9.0-napi-jsc.11
@@ -40,16 +40,16 @@ (function () { | ||
// 2: return super() || this; | ||
// if (thiz.__container__) { | ||
// if (__useHostObjects) { | ||
// for (var prop in thiz) { | ||
// if (thiz.hasOwnProperty(prop)) { | ||
// thiz.__proto__[prop] = thiz[prop]; | ||
// delete thiz[prop]; | ||
// } | ||
// } | ||
// } | ||
// if (thiz.__container__) { | ||
// if (__useHostObjects) { | ||
// for (var prop in thiz) { | ||
// if (thiz.hasOwnProperty(prop)) { | ||
// thiz.__proto__[prop] = thiz[prop]; | ||
// delete thiz[prop]; | ||
// } | ||
// } | ||
// } | ||
return thiz; | ||
// } else { | ||
// return thiz; | ||
// } | ||
return thiz; | ||
// } else { | ||
// return thiz; | ||
// } | ||
}; | ||
@@ -96,3 +96,3 @@ | ||
} else { | ||
thiz = new (Function.prototype.bind.apply( | ||
thiz = new (Function.prototype.bind.apply( | ||
Extended, | ||
@@ -103,3 +103,3 @@ [null].concat(Array.prototype.slice.call(arguments, 1)) | ||
} else { | ||
thiz = new Extended(); | ||
thiz = new Extended(); | ||
} | ||
@@ -113,6 +113,13 @@ return thiz; | ||
if (args && args.length > 0) { | ||
thiz = new (Function.prototype.bind.apply( | ||
Extended, | ||
[null].concat(args) | ||
))(); | ||
if (typeof Extended !== "function") { | ||
thiz = Reflect.construct( | ||
Extended, | ||
[null].concat(args) | ||
); | ||
} else { | ||
thiz = new (Function.prototype.bind.apply( | ||
Extended, | ||
[null].concat(args) | ||
))(); | ||
} | ||
} else { | ||
@@ -268,10 +275,65 @@ thiz = new Extended(); | ||
}; | ||
function findInPrototypeChain(obj, prop) { | ||
while (obj) { | ||
if (obj.hasOwnProperty(prop)) { | ||
return Object.getOwnPropertyDescriptor(obj, prop); | ||
} | ||
obj = Object.getPrototypeOf(obj); | ||
} | ||
return undefined; | ||
} | ||
globalThis.__prepareHostObject = function (hostObject, jsThis) { | ||
// const prototype = Object.getPrototypeOf(jsThis); | ||
// Object.setPrototypeOf(hostObject, prototype); | ||
Object.defineProperty(hostObject, "super", { | ||
get: () => jsThis["super"], | ||
}); | ||
}; | ||
const EXTERNAL_PROP = "[[external]]"; | ||
const REFERENCE_PROP_JSC = "[[jsc_reference_info]]"; | ||
function __createNativeProxy(object, objectId) { | ||
const proxy = new Proxy(object, { | ||
get: function (target, prop) { | ||
if (prop === EXTERNAL_PROP) return this[EXTERNAL_PROP]; | ||
if (prop === REFERENCE_PROP_JSC) return this[REFERENCE_PROP_JSC]; | ||
if (target.__is__javaArray) { | ||
return global.getNativeArrayProp(target, prop, target); | ||
} | ||
return target[prop]; | ||
}, | ||
set: function (target, prop, value) { | ||
if (prop === EXTERNAL_PROP) { | ||
this[EXTERNAL_PROP] = value; | ||
return true; | ||
} | ||
if (prop === REFERENCE_PROP_JSC) { | ||
this[REFERENCE_PROP_JSC] = value; | ||
} | ||
if (target.__is__javaArray && !isNaN(prop)) { | ||
target.setValueAtIndex(parseInt(prop), value); | ||
return true; | ||
} | ||
target[prop] = value; | ||
return true; | ||
}, | ||
}); | ||
return proxy; | ||
} | ||
globalThis.__createNativeProxy = __createNativeProxy; | ||
globalThis.getErrorStack = (err) => { | ||
if (err) return err.stack; | ||
const stack = new Error("").stack; | ||
const lines = stack.split("\n"); | ||
// Line 2 results in invalid stack if not replaced when doing typescript extend. | ||
lines[2] = " at extend(native)"; | ||
return lines.join("\n"); | ||
}; | ||
})(); | ||
globalThis.getErrorStack = (err) => { | ||
if (err) return err.stack; | ||
const stack = new Error("").stack; | ||
const lines = stack.split("\n"); | ||
// Line 2 results in invalid stack if not replaced when doing typescript extend. | ||
lines[2] = " at extend(native)"; | ||
return lines.join("\n"); | ||
}; |
{ | ||
"name": "@nativescript/android", | ||
"description": "NativeScript for Android using Node-API", | ||
"version": "8.9.0-napi-jsc.6", | ||
"version": "8.9.0-napi-jsc.11", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
61381777
2377