Socket
Socket
Sign inDemoInstall

@types/history

Package Overview
Dependencies
0
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/history

TypeScript definitions for history


Version published
Maintainers
1
Install size
10.2 kB
Created

Package description

What is @types/history?

The @types/history package provides TypeScript type definitions for the 'history' library, which is used for managing session history in JavaScript environments like browsers and Node.js. This package is essential for TypeScript developers who use the 'history' library, as it offers type safety and autocompletion features during development.

What are @types/history's main functionalities?

Creating Browser History

This feature allows you to create a history object that uses the HTML5 history API to manage the session history. This is useful for web applications that need to manipulate the browser history.

import { createBrowserHistory } from 'history';
const history = createBrowserHistory();

Navigating Programmatically

Enables programmatic navigation in your application. You can use 'push' to add a new entry to the history stack or 'replace' to replace the current entry. This is particularly useful for handling redirects in single-page applications (SPAs).

history.push('/home');
history.replace('/login');

Listening to History Changes

This feature allows you to listen for changes in the history stack, which is useful for responding to back or forward navigation actions performed by the user.

history.listen((location, action) => {
  console.log(`The current URL is ${location.pathname}${location.search}${location.hash}`);
  console.log(`The last navigation action was ${action}`);
});

Other packages similar to @types/history

Readme

Source

Installation

npm install --save @types/history

Summary

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

Details

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

Additional Details

  • Last updated: Mon, 13 Nov 2017 23:27:01 GMT
  • Dependencies: none
  • Global values: History

Credits

These definitions were written by Sergey Buturlakin https://github.com/sergey-buturlakin, Nathan Brown https://github.com/ngbrown, Young Rok Kim https://github.com/rokoroku.

FAQs

Last updated on 13 Nov 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc