diff --git a/src/utils/AbortableOperation.ts b/src/utils/AbortableOperation.ts index 0cc49e10..d03f820a 100644 --- a/src/utils/AbortableOperation.ts +++ b/src/utils/AbortableOperation.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -interface IAbortable { +export interface IAbortable { abort(); } diff --git a/src/utils/timeout.ts b/src/utils/timeout.ts index 96efc10d..f0460047 100644 --- a/src/utils/timeout.ts +++ b/src/utils/timeout.ts @@ -17,12 +17,11 @@ limitations under the License. import {ConnectionError} from "../matrix/error.js"; import type {Timeout} from "../platform/web/dom/Clock.js" +import type {IAbortable} from "./AbortableOperation"; type TimeoutCreator = (ms: number) => Timeout; -// ts-todo: export type RequestResult from fetch.js? we'll need to wait until it's typescript though. -type Abortable = { abort(): void; [key: string]: any }; -export function abortOnTimeout(createTimeout: TimeoutCreator, timeoutAmount: number, requestResult: Abortable, responsePromise: Promise) { +export function abortOnTimeout(createTimeout: TimeoutCreator, timeoutAmount: number, requestResult: IAbortable, responsePromise: Promise) { const timeout = createTimeout(timeoutAmount); // abort request if timeout finishes first let timedOut = false;