Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.
/ hover-battery Public archive

🔋LocalStorage / SessionStorage Memory for your Hover-Engine Store

Notifications You must be signed in to change notification settings

Tram-One/hover-battery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hover-battery

Downloads Version License

LocalStorage / SessionStorage Memory for your Hover-Engine Store

By including this in your project, Hover-Engine can persist it's store across page reloads and navigation.

Install

npm install --save hover-battery

Usage

After building your engine with all the actions you plan on using, add the hover-battery action and listener. You can choose to pass in localStorage, sessionStorage, or some other object you want to write to.

const Hover = require('hover-engine')
const battery = require('hover-battery')

const engine = new Hover()
// addActions to your engine
engine.addListener(battery(localStorage).listener)
engine.addActions(battery(localStorage).actions)

You must call the addActions with the battery after you have defined all your other actions.

Usage (Tram-One)

You may want to use this with the view framework Tram-One. If you do, it's pretty much exactly the same as above.

const Tram = require('tram-one')
const battery = require('hover-battery')

const app = new Tram()
// addActions to your app
app.addListener(battery(localStorage).listener)
app.addActions(battery(localStorage).actions)

Development

First, clone this repository, and install the dependencies.

git clone https://github.com/Tram-One/hover-battery
cd hover-battery
npm install

You can run the tests (which use a combination of NightmareJS and Jasmine)

npm test

PRs Welcome!

About

🔋LocalStorage / SessionStorage Memory for your Hover-Engine Store

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published