# @types/history.js

> TypeScript definitions for history.js

Latest version **1.8.20** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/history.js
pnpm add @types/history.js
yarn add @types/history.js
bun add @types/history.js
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.8.20 |
| Published | 2023-11-07 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51436 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/history.js
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history.js
- npm.io page: https://npm.io/package/@types/history.js

## Recent versions

- 1.8.20 (latest) — 2023-11-07
- 1.8.17 (ts3.6) — 2021-07-08
- 1.8.16 (ts2.0) — 2017-08-21
- 1.8.19 — 2023-10-18
- 1.8.18 — 2023-09-16
- 1.8.15 — 2017-03-10
- 1.8.14 — 2016-09-19
- 1.8.13 — 2016-07-14
- 1.8.12-alpha — 2016-07-08
- 1.8.11-alpha — 2016-07-04
- 1.8.10-alpha — 2016-07-02
- 1.8.9-alpha — 2016-07-01
- 1.8.8-alpha — 2016-05-25
- 1.8.7-alpha — 2016-05-20
- 1.8.2-alpha — 2016-05-19
- … 1 more at https://npm.io/package/@types/history.js/versions

## README

# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history.js/index.d.ts)
````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](https://github.com/borisyankov), and [Gidon Junge](https://github.com/gjunge).

---
_Source: https://npm.io/package/@types/history.js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
