MCPcopy Create free account
hub / github.com/Snapchat/Valdi / attachToJSPromise

Method attachToJSPromise

valdi/src/valdi/runtime/JavaScript/JSPromise.cpp:36–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void JSPromiseCancel::attachToJSPromise(IJavaScriptContext& jsContext,
37 const JSValue& jsPromise,
38 const Ref<Promise>& nativePromise,
39 JSExceptionTracker& exceptionTracker) {
40 auto cancelFunction = jsContext.newFunction(makeShared<JSPromiseCancel>(nativePromise), exceptionTracker);
41 if (!exceptionTracker) {
42 return;
43 }
44
45 jsContext.setObjectProperty(jsPromise, getCancelPropertyKey(jsContext), cancelFunction.get(), exceptionTracker);
46}
47
48JSValueRef JSPromiseCancel::getFromJSPromise(IJavaScriptContext& jsContext,
49 const JSValue& jsPromise,

Callers

nothing calls this directly

Calls 4

getCancelPropertyKeyFunction · 0.85
getMethod · 0.65
newFunctionMethod · 0.45
setObjectPropertyMethod · 0.45

Tested by

no test coverage detected