MCPcopy Index your code
hub / github.com/apache/tvm / asyncVariant

Method asyncVariant

web/src/runtime.ts:1813–1827  ·  view source on GitHub ↗
(...args: Array<any>)

Source from the content-addressed store, hash-verified

1811 override = false
1812 ): void {
1813 const asyncVariant = (...args: Array<any>): void => {
1814 const fargs = args.slice(0, args.length - 1);
1815 // need to keep it alive until callback is fulfilled.
1816 const callback = this.detachFromCurrentScope(args[args.length - 1] as PackedFunc);
1817 const promise: Promise<any> = func(...fargs);
1818 const onFulfilled = (rv: any) => {
1819 callback(this.scalar(AsyncCallbackCode.kReturn, "int32"), rv);
1820 callback.dispose();
1821 };
1822 const onRejected = (reason: any) => {
1823 callback(this.scalar(AsyncCallbackCode.kException, "int32"), reason.toString());
1824 callback.dispose();
1825 };
1826 promise.then(onFulfilled, onRejected);
1827 };
1828 this.registerFunc("__async." + name, asyncVariant, override);
1829 }
1830

Callers

nothing calls this directly

Calls 3

funcFunction · 0.50
sliceMethod · 0.45

Tested by

no test coverage detected