Skip to content

Commit

Permalink
Remove dependency on dom.d.ts (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfbecker authored and sindresorhus committed Oct 10, 2018
1 parent e589469 commit 04ef16f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions index.d.ts
@@ -1,12 +1,21 @@
/// <reference lib="dom"/>

export interface ClearablePromise<T> extends Promise<T> {
/**
* Clears the delay and settles the promise.
*/
clear(): void;
}

/**
* Minimal subset of `AbortSignal` that delay will use if passed.
* This avoids a dependency on dom.d.ts.
* The dom.d.ts `AbortSignal` is compatible with this one.
*/
interface AbortSignal {
readonly aborted: boolean;
addEventListener(type: 'abort', listener: () => void, options?: { once?: boolean }): void;
removeEventListener(type: 'abort', listener: () => void): void;
}

export interface Options {
/**
* An optional AbortSignal to abort the delay.
Expand Down

0 comments on commit 04ef16f

Please sign in to comment.