Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

domelementhistory

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domelementhistory

Forward-Backward functionality given a certain DOM Element. Works like browser history but for a specific element without reloading the window.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

DOM Element History

Methods

  • constructor():

    • parameters: A DOM element
    • functionality: Initializes the historyArray for the specific DOM element and saves current innerHTML as initial state.
  • saveState():

    • parameters: None
    • functionality: Saves current DOM element innerHTML state in historyArray
  • goBack():

    • parameters: None
    • functionality: Moves back one state in the historyArray
  • goForward():

    • parameters: None
    • functionality: Any states after current state are deleted. Moves forward one state in the historyArray.

Example Usage

var domElementHistory = require("domelementhistory");
var main = document.getElementsByTagName("main")[0];
var mainHistory = new domElementHistory.History(main);

// Let's say something changes here in the main element

mainHistory.saveState();

// Let's say for some reason you would wish to go back or forward

mainHistory.goBack();
mainHistory.goForward();

FAQs

Package last updated on 01 Aug 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc