Socket
Socket
Sign inDemoInstall

domelementhistory

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
3
Maintainers
1
Install size
3.76 kB
Created
Weekly downloads
 

Readme

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

Last updated on 01 Aug 2018

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