import type ServiceScope from '../ServiceScope'; import type { IServiceKey } from '../IServiceKey'; /** * This is a {@link ServiceScope} contract for reading the system clock. * * @remarks * This interface abstracts the functionality of the system time APIs * for usage with a {@link ServiceScope}. For example, a unit test might replace * the default {@link TimeProvider} service with a mock implementation * that follows a manually incremented timeline, in order to ensure that * test failures are always repeatable. * * @public */ export interface ITimeProvider { /** * Returns the current date/time, similar to the Date class constructor. */ getDate(): Date; /** * Returns a DOMHighResTimeStamp timing measurement, as defined by the * standard performance.now() API. */ getTimestamp(): number; } /** * This is the default implementation of {@link ITimeProvider} that simply * calls the real browser APIs. * * @public */ export default class TimeProvider implements ITimeProvider { /** * The service key for ITimeProvider. */ static readonly serviceKey: IServiceKey; constructor(serviceScope: ServiceScope); /** {@inheritDoc ITimeProvider.getDate} */ getDate(): Date; /** {@inheritDoc ITimeProvider.getTimestamp} */ getTimestamp(): number; } //# sourceMappingURL=TimeProvider.d.ts.map