Skip to content

Releases: github/session-resume

v0.5.2

Choose a tag to compare

@dgreif dgreif released this 18 Oct 00:37
78ce055

What's Changed

New Contributors

Full Changelog: v0.5.1...v0.5.2

v0.5.1

Choose a tag to compare

@manuelpuyol manuelpuyol released this 09 Jul 18:16
4936109

What's Changed

Full Changelog: v0.5.0...v0.5.1

v0.5.0

Choose a tag to compare

@theinterned theinterned released this 08 Feb 20:38
7b4243a

What's Changed

New Contributors

  • @helen made their first contribution in #30

Full Changelog: v0.4.0...v0.5.0

v0.4.0

Choose a tag to compare

@theinterned theinterned released this 24 Jan 20:46
cee83c0

What's Changed

New Contributors

Full Changelog: v0.3.1...v0.4.0

v0.3.1

Choose a tag to compare

@theinterned theinterned released this 20 Oct 19:11
1236700

What's Changed

  • Make sure to access sessionStorage in a try block by @Bestra in #39

Full Changelog: v0.3.0...v0.3.1

v0.3.0

Choose a tag to compare

@manuelpuyol manuelpuyol released this 13 Oct 15:25
e2d3656

What's Changed

New Contributors

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@koddsson koddsson released this 23 Apr 10:04
v0.2.0
7e40603

Session Resume now persists fields that are not immediately present in the DOM. (#16) Thank you @jklina 🎉

0.1.0

Choose a tag to compare

@dgraham dgraham released this 10 Apr 22:14
v0.1.0
  • Replace Babel + Flow with TypeScript #13

v0.0.7

Choose a tag to compare

@koddsson koddsson released this 05 Aug 15:04
a99e4a4
  • Merge pull request #10 from github/fix-gpr-publish d24f7d3
  • dont run scripts when publishing to GPR aa5bd56

0.0.6...v0.0.7

0.0.7

Choose a tag to compare

@koddsson koddsson released this 05 Aug 15:04
d24f7d3

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.