AbortController for OpenHarmony based on emitter
.
The bulk of the code in this project is derived from node-abort-controller, with certain alterations made to suit the features of HarmonyOS.
API Version >= 11
ohpm install @ohos-rs/abort-controller
const controller = new AbortController();
asyncFib(20, controller.signal).catch((e: ESObject) => {
console.error(e) // Error: AbortError
})
controller.abort()