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

1.8.20 • Public • Published

Installation

npm install --save @types/history.js

Summary

This package contains type definitions for history.js (https://github.com/browserstate/history.js).

Details

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

index.d.ts

interface HistoryAdapter {
    bind(element: any, event: string, callback: () => void): void;
    trigger(element: any, event: string): void;
    onDomLoad(callback: () => void): void;
}

// Since History is defined in lib.d.ts as well
// the name for our interfaces was chosen to be Historyjs
// However at runtime you would need to do
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/277
// var Historyjs: Historyjs = <any>History;

interface Historyjs {
    enabled: boolean;

    pushState(data: any, title: string, url: string, queue?: boolean): boolean;
    replaceState(data: any, title: string, url: string, queue?: boolean): boolean;
    getState(friendly?: boolean, create?: boolean): HistoryState;
    getStateId(passedState: HistoryState): string;
    getStateById(id: string): HistoryState;
    getStateByIndex(index: number): HistoryState;
    getCurrentIndex(): number;
    getHash(): string;

    Adapter: HistoryAdapter;

    back(): void;
    forward(): void;
    go(x: Number): void;

    log(...messages: any[]): void;
    debug(...messages: any[]): void;

    options: HistoryOptions;

    /**
     * History.setTitle(title)
     * Applies the title to the document
     * @param {HistoryState} newState
     * @return {Boolean}
     */
    setTitle(newState: HistoryState): boolean;
    clearQueue(): Historyjs;
    clearAllIntervals(): void;
    getRootUrl(): string;

    emulated: {
        hashChange?: any;
        pushState?: any;
    };
}

interface HistoryState {
    data?: any;
    title?: string | undefined;
    url: string;
    hashedUrl?: string | undefined;
    cleanUrl?: string | undefined;
}

interface HistoryOptions {
    hashChangeInterval?: number | undefined;
    safariPollInterval?: number | undefined;
    doubleCheckInterval?: number | undefined;
    disableSuid?: boolean | undefined;
    storeInterval?: number | undefined;
    busyDelay?: number | undefined;
    debug?: boolean | undefined;
    initialTitle?: string | undefined;
    html4Mode?: boolean | undefined;
    delayInit?: number | undefined;
}

Additional Details

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

Credits

These definitions were written by Boris Yankov, and Gidon Junge.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.8.2040ts5.8
1.8.2040ts5.7
1.8.2040latest
1.8.2040ts4.5
1.8.2040ts4.6
1.8.2040ts4.7
1.8.2040ts4.8
1.8.2040ts4.9
1.8.2040ts5.0
1.8.2040ts5.1
1.8.2040ts5.2
1.8.2040ts5.3
1.8.2040ts5.4
1.8.2040ts5.5
1.8.2040ts5.6
1.8.2040ts5.9
1.8.1615ts2.0
1.8.1615ts2.1
1.8.1615ts2.2
1.8.1615ts2.3
1.8.1615ts2.4
1.8.1615ts2.5
1.8.1615ts2.6
1.8.1615ts2.7
1.8.1615ts2.8
1.8.1615ts2.9
1.8.1615ts3.0
1.8.1615ts3.1
1.8.1615ts3.2
1.8.1615ts3.3
1.8.1615ts3.4
1.8.1615ts3.5
1.8.176ts3.6
1.8.176ts3.7
1.8.176ts3.8
1.8.176ts3.9
1.8.176ts4.0
1.8.176ts4.1
1.8.176ts4.2
1.8.176ts4.3
1.8.176ts4.4

Version History

VersionDownloads (Last 7 Days)Published
1.8.2040
1.8.191
1.8.181
1.8.176
1.8.1615
1.8.152
1.8.141
1.8.131
1.8.12-alpha1
1.8.11-alpha1
1.8.10-alpha1
1.8.9-alpha1
1.8.8-alpha1
1.8.7-alpha1
1.8.2-alpha1
1.8.1-alpha1

Package Sidebar

Install

npm i @types/history.js

Weekly Downloads

75

Version

1.8.20

License

MIT

Unpacked Size

6.88 kB

Total Files

5

Last publish

Collaborators

  • types