/** * Ported from https://github.com/zio/zio/blob/master/core/shared/src/main/scala/zio/Clock.scala * * Copyright 2020 Michael Arnaldi and the Matechs Garage Contributors. */ import "../Operator/index.js"; import type { Effect, UIO } from "../Effect/effect.js"; import type { Has, Tag } from "../Has/index.js"; import { ClockId } from "./id.js"; export { ClockId }; export declare abstract class Clock { readonly serviceId: ClockId; abstract readonly currentTime: UIO; abstract readonly sleep: (ms: number, __trace?: string) => UIO; } export declare const HasClock: Tag; export declare type HasClock = Has; export declare class LiveClock extends Clock { currentTime: UIO; sleep: (ms: number, __trace?: string) => UIO; } export declare class ProxyClock extends Clock { readonly currentTime: UIO; readonly sleep: (ms: number, __trace?: string) => UIO; constructor(currentTime: UIO, sleep: (ms: number, __trace?: string) => UIO); } /** * Get the current time in ms since epoch */ export declare const currentTime: Effect, never, number>; /** * Sleeps for the provided amount of ms */ export declare function sleep(ms: number, __trace?: string): Effect, never, void>; /** * Access clock from environment */ export declare const withClockM: (f: (a: Clock) => Effect, __trace?: string | undefined) => Effect, E, B>; /** * Access clock from environment */ export declare const withClock: (f: (a: Clock) => B, __trace?: string | undefined) => Effect, never, B>; export declare class TestClock extends Clock { private time; readonly currentTime: UIO; readonly sleep: (ms: number) => UIO; readonly advance: (ms: number) => UIO; static advance: (ms: number) => Effect, never, void>; } /** * Accesses the TestClock */ export declare const HasTestClock: Tag; export declare const provideTestClock: (ma: Effect & Has, E1, A1>) => Effect; //# sourceMappingURL=index.d.ts.map