@types/nanotimer
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

Installation

npm install --save @types/nanotimer

Summary

This package contains type definitions for nanotimer (https://github.com/Krb686/nanotimer).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nanotimer.

index.d.ts

declare namespace NanoTimer {
    interface TimeoutResults {
        waitTime: number;
    }
}

declare class NanoTimer {
    /**
     * Creates an instance of NanoTimer.
     * @param log - if true, will enable logging.
     */
    constructor(log?: boolean);

    /**
     * Call the task after the waiting the the timeout specified.
     */
    setTimeout(
        task: (...args: any[]) => void,
        args: any[] | string,
        timeout: string,
        callback?: (results: NanoTimer.TimeoutResults) => void,
    ): void;

    /**
     * Clears current running timeOut.
     */
    clearTimeout(): void;

    /**
     * Call the task at the regular interval specified in interval.
     */
    setInterval(
        task: (...args: any[]) => void,
        args: any[] | string,
        interval: string,
        callback?: (error: Error) => void,
    ): void;

    /**
     * Clears current running interval.
     */
    clearInterval(): void;

    /**
     * Calculate the time it tooks to execute the task.
     */
    time(
        task: (cb: () => void) => void,
        args: string | any[],
        interval: string,
        callback?: (error: Error) => void,
    ): number;

    /**
     * Returns true if the timer currently has a scheduled timeout, or false otherwise
     */
    hasTimeout(): boolean;
}

export = NanoTimer;

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: none

Credits

These definitions were written by Samuel Bodin.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/nanotimer

Weekly Downloads

610

Version

0.3.2

License

MIT

Unpacked Size

5.23 kB

Total Files

5

Last publish

Collaborators

  • types