Releases: github/session-resume
Releases · github/session-resume
0.0.6
Session Resume
Annotate fields to be persisted on navigation away from the current page.
Fields be automatically restored when the user revists the page again in
their current browser session (excludes separate tabs).
Not design for persisted crash recovery.
Installation
$ npm install @github/session-resume
Usage
HTML
<form>
<input id="new-comment" class="js-session-resumable"/>
</form>
JS
import {persistResumableFields, restoreResumableFields, setForm} from '@github/session-resume'
function getPageID() {
return window.location.pathname
}
// Listen for all form submit events and to see if their default submission
// behavior is invoked.
window.addEventListener('submit', setForm, {capture: true})
// Resume field content on regular page loads.
window.addEventListener('pageshow', function() {
restoreResumableFields(getPageID())
})
// Persist resumable fields when page is unloaded
window.addEventListener('pagehide', function() {
persistResumableFields(getPageID())
})
Development
npm install
npm test
License
Distributed under the MIT license. See LICENSE for details.
v0.0.5
0.0.5
Session Resume
Annotate fields to be persisted on navigation away from the current page.
Fields be automatically restored when the user revists the page again in
their current browser session (excludes separate tabs).
Not design for persisted crash recovery.
Installation
$ npm install @github/session-resume
Usage
HTML
<form>
<input id="new-comment" class="js-session-resumable"/>
</form>
JS
import {persistResumableFields, restoreResumableFields, setForm} from '@github/session-resume'
function getPageID() {
return window.location.pathname
}
// Listen for all form submit events and to see if their default submission
// behavior is invoked.
window.addEventListener('submit', setForm, {capture: true})
// Resume field content on regular page loads.
window.addEventListener('pageshow', function() {
restoreResumableFields(getPageID())
})
// Persist resumable fields when page is unloaded
window.addEventListener('pagehide', function() {
persistResumableFields(getPageID())
})
Development
npm install
npm test
License
Distributed under the MIT license. See LICENSE for details.
v0.0.4
- npm audit fix 00346d6
- Merge pull request #5 from github/update-deps 003d3ce
- update eslint, eslint-plugin-github, flow-bin and mocha manually to latest versions 3962b4e
- fix shadowed variable ef2b229
- run
npm update
3ca559c - set repository field correctly 5b5fcea
- Merge pull request #3 from github/ci ba39a47
- reference bundle in parent folder aaf0b4b
- add travis configuration file 4a8cce7
- Merge pull request #4 from github/lint d1a6d41
- remove unused variable a08be83
- run prettier 5de792b
- generate prettier config 7cff22c
- move test files into test directory 1245643
- dont lint dist folder 76c6bab
- dont run flow twice 3044887
- install eslint-plugin-github 56a8028
- Create CODE_OF_CONDUCT.md 70b30a6
- Create CONTRIBUTING.md 59cd6f4