1.8.20 • Published 6 months ago

@types/history.js v1.8.20

Weekly downloads
211
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for History.js 1.8.0
// Project: https://github.com/browserstate/history.js
// Definitions by: Boris Yankov <https://github.com/borisyankov>, Gidon Junge <https://github.com/gjunge>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped


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: Thu, 08 Jul 2021 14:22:52 GMT
  • Dependencies: none
  • Global values: none

Credits

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

1.8.20

6 months ago

1.8.18

8 months ago

1.8.19

7 months ago

1.8.17

3 years ago

1.8.16

7 years ago

1.8.15

7 years ago

1.8.14

8 years ago

1.8.13

8 years ago

1.8.12-alpha

8 years ago

1.8.11-alpha

8 years ago

1.8.10-alpha

8 years ago

1.8.9-alpha

8 years ago

1.8.8-alpha

8 years ago

1.8.7-alpha

8 years ago

1.8.2-alpha

8 years ago

1.8.1-alpha

8 years ago