Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 394 Bytes

signal-from-promise.md

File metadata and controls

18 lines (12 loc) · 394 Bytes

signalFromPromise(promise)

Returns an AbortSignal that aborts when the promise is resolved or rejected.

// Remove event listener after the animation is complete
window.addEventListener('keydown', cancelAnimation, {
	signal: signalFromPromise(animationPromise)
});

promise

Type: Promise

The promise to watch for resolution or rejection.