MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / wrap

Method wrap

packages/devtools/src/devtoolsRuntime.ts:85–107  ·  view source on GitHub ↗
(handler: T)

Source from the content-addressed store, hash-verified

83 }
84
85 private static wrap<T extends Object>(handler: T): T {
86 return new Proxy(handler, {
87 get(target, prop) {
88 if (typeof target[prop] === 'function') {
89 return (params, message: ProtocolMessage) => {
90 try {
91 // console.warn('[incoming]', {
92 // id: message.id,
93 // method: message.method,
94 // params,
95 // message,
96 // });
97 const res = target[prop](params, message);
98 ProtocolWrapper.sendResponseToDevtools(message.id, res);
99 return res;
100 } catch (err) {
101 console.error(err);
102 }
103 };
104 }
105 },
106 }) as T;
107 }
108}

Callers 1

constructorMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected