/** * (c) 2021, Micro:bit Educational Foundation and contributors * * SPDX-License-Identifier: MIT */ import { DeviceError } from "./device.js"; export declare class TimeoutError extends DeviceError { constructor(message?: string); } export declare class DisconnectError extends Error { constructor(message?: string); } /** * Utility to time out an action after a delay. * * The action cannot be cancelled; it may still proceed after the timeout. */ export declare function withTimeout(actionPromise: Promise, timeout: number): Promise; export declare function delay(millis: number): Promise; export declare function timeoutErrorAfter(millis: number, message?: string): Promise; export declare function disconnectErrorCallback(message?: string): { promise: Promise; callback: () => void | undefined; };