MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / nativeMethod

Function nativeMethod

packages/nativescript-inspector/src/index.ts:1346–1362  ·  view source on GitHub ↗
(
  target: any,
  klass: any,
  methodName: string,
)

Source from the content-addressed store, hash-verified

1344}
1345
1346function nativeMethod(
1347 target: any,
1348 klass: any,
1349 methodName: string,
1350): (...args: unknown[]) => unknown {
1351 if (typeof target?.[methodName] === "function") {
1352 return target[methodName].bind(target);
1353 }
1354 const inherited = klass?.prototype?.[methodName];
1355 if (typeof inherited === "function") {
1356 return inherited.bind(target);
1357 }
1358 throw new InspectorFailure(
1359 -32011,
1360 `${className(target)} does not expose ${methodName}.`,
1361 );
1362}
1363
1364function nsWebSocketMessageText(message: any): string | null {
1365 if (!message) {

Callers 1

Calls 1

classNameFunction · 0.85

Tested by

no test coverage detected