MCPcopy Create free account
hub / github.com/NativeScript/android / __native

Function __native

test-app/app/src/main/assets/internal/ts_helpers.js:21–48  ·  view source on GitHub ↗
(thiz)

Source from the content-addressed store, hash-verified

19
20 // For backward compatibility.
21 var __native = function (thiz) {
22 // we are setting the __container__ property to the base class when the super method is called
23 // if the constructor returns the __native(this) call we will use the old implementation
24 // copying all the properties to the result
25 // otherwise if we are using the result from the super() method call we won't need such logic
26 // as thiz already contains the parent properties
27 // this way we now support both implementations in typescript generated constructors:
28 // 1: super(); return __native(this);
29 // 2: return super() || this;
30 if (thiz.__container__) {
31 var result = thiz.__proto__;
32
33 for (var prop in thiz) {
34 if (thiz.hasOwnProperty(prop)) {
35 thiz.__proto__[prop] = thiz[prop];
36 delete thiz[prop];
37 }
38 }
39
40 thiz.constructor = undefined;
41 thiz.__proto__ = undefined;
42 Object.freeze(thiz);
43 Object.preventExtensions(thiz);
44 return result;
45 } else {
46 return thiz;
47 }
48 };
49
50 var __extends = function (Child, Parent) {
51 var extendNativeClass = !!Parent.extend && (Parent.extend.toString().indexOf("[native code]") > -1);

Callers 10

MyButton1Function · 0.50
MyButton2Function · 0.50
MyButton3Function · 0.50
MyButtonWithArgsFunction · 0.50
MyButton4Function · 0.50
MyButton5Function · 0.50
MyButton6Function · 0.50
ListViewAdapterFunction · 0.50
MyButton10Function · 0.50
MyButton11Function · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected