Skip to content

Commit

Permalink
Add AbortSignal support
Browse files Browse the repository at this point in the history
  • Loading branch information
lxsmnsyc committed Dec 21, 2024
1 parent 67cb261 commit ce4b1d6
Show file tree
Hide file tree
Showing 46 changed files with 1,352 additions and 653 deletions.
13 changes: 13 additions & 0 deletions packages/seroval/src/core/abort-signal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function abortSignalToPromise(signal: AbortSignal): Promise<any> {
return new Promise(resolve => {
signal.addEventListener(
'abort',
() => {
resolve(signal.reason);
},
{
once: true,
},
);
});
}
Loading

0 comments on commit ce4b1d6

Please sign in to comment.