Skip to content

Repository files navigation

bf-lifecycle

A class helps to trigger callback functions by history traversal

NPMJavaScript Style Guide

Applied examples

example1example2

Install

npm install --save bf-lifecycle

Usage

importBackForwardLifecyclefrom'bf-lifecycle';letdata;constbfLifecycle=newBackForwardLifecycle({callback: ()=>{data='bfcache';},storeState: ()=>{sessionStorage.setItem('data','nobfcache');},restoreState: ()=>sessionStorage.getItem('data'),options: {hasDependency: true,withClearScrollWillNotStoreBfCache: true,},});bfLifecycle.mount();data=bfLifecycle.triggerRestoreState();

Documentation

See here

<ahref="ansrlm.github.io/bf-lifecycle">BF-LIFECYCLE</a>

Upcoming

Soon be added time-expire function on bf-lifecycle v1.1.0

Then bf-lifecycle will support react framework as hook (expect in v2.1.0)

License

MIT © ansrlm

About

A class helps to trigger callback functions by history traversal

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages