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

Method cancel

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

Source from the content-addressed store, hash-verified

141 _cancelable(JSPromiseCancel::isJSPromiseCancelable(jsContext, jsValue)) {
142 // onComplete() runs a task later, after the engine has already flushed its rejection tracker.
143 jsContext.markPromiseRejectionHandled(jsValue);
144}
145
146JSPromise::~JSPromise() = default;
147
148void JSPromise::onComplete(const Ref<PromiseCallback>& callback) {
149 auto taskScheduler = _jsValue.getTaskScheduler();
150 if (taskScheduler != nullptr) {
151 taskScheduler->dispatchOnJsThreadAsync(
152 _jsValue.getContext(), [self = strongSmallRef(this), callback](const JavaScriptEntryParameters& jsEntry) {
153 self->doOnComplete(callback, jsEntry);
154 });
155 }
156}
157

Callers

nothing calls this directly

Calls 5

doCancelMethod · 0.95
strongSmallRefFunction · 0.85
getTaskSchedulerMethod · 0.45
getContextMethod · 0.45

Tested by

no test coverage detected