tickle/modules/utils/waitIfLocalHost.mjs

25 lines
730 B
JavaScript
Raw Permalink Normal View History

//@ts-check
import wait from "./wait.mjs";
2023-05-09 02:00:53 +00:00
import { awaitedIdentity } from "./identity.mjs";
import isLocalHost from "./isLocalHost.mjs";
/**
* Waits the specified amount of time before returning the value
* @param {number} _durationMs Duration, in milliseconds. Defaults to 1 second
* @returns
*/
2023-05-09 02:00:53 +00:00
const fakeWait = (_durationMs = 1000) => awaitedIdentity;
/**
* useful to check for transitions while developing styles, if the loading screen
* disappears too fast for example.
* @template T
* @param {number} durationMs Duration, in milliseconds. Defaults to 1 second
* @returns {(value?: T | undefined) => Promise<T>}
*/
export const waitIfLocalHost = isLocalHost ? wait : fakeWait;
export default waitIfLocalHost;