MCPcopy Index your code
hub / github.com/NativeScript/capacitor / constructor

Method constructor

testing/browser.ts:106–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104 _callbacks = [];
105
106 constructor() {
107 if (NativeScriptProxy.instance) {
108 return NativeScriptProxy.instance[NS_PROXY];
109 }
110 NativeScriptProxy.instance = this;
111
112 this._id = 0;
113 this._trackingId = 0;
114 this._tracking = {};
115
116 const proxy = this.getProxy(null, 'native', native_handler);
117 (<any>this)[NS_PROXY] = proxy;
118 (<any>this)[NS_PROXY_FUNCTION] = proxy.__func;
119
120 // Setup the Listener from NativeScript
121 (<any>NativeScriptCap).addListener('fromNativeScript', (info: any) => {
122 this.receiveMessage(info);
123 });
124
125 // Let the NS know we are here, fire this after we have returned the proxy object below
126 setTimeout(() => {
127 this.sendMessage({ cmd: NS_MARSHALL_STARTUP });
128 }, 0);
129
130 return proxy;
131 }
132
133 sendMessage(msg: any) {
134 if (DEBUGGING) {

Callers

nothing calls this directly

Calls 4

getProxyMethod · 0.95
receiveMessageMethod · 0.95
sendMessageMethod · 0.95
addListenerMethod · 0.80

Tested by

no test coverage detected