All Projects → github → session-resume

github / session-resume

Licence: MIT license
Annotate fields to be persisted on navigation away from the current page

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Labels

Projects that are alternatives of or similar to session-resume

min
A decorator web framework for deno
Stars: ✭ 21 (-80%)
Mutual labels:  decorator
textarea-autosize
Autosizes textarea to size of it's contents.
Stars: ✭ 73 (-30.48%)
Mutual labels:  decorator
bash-cache
Transparent caching layer for bash functions; particularly useful for functions invoked as part of your prompt.
Stars: ✭ 45 (-57.14%)
Mutual labels:  decorator
ngx-redux-core
The modern redux integration for Angular 6+
Stars: ✭ 32 (-69.52%)
Mutual labels:  decorator
laravel-decorator
Easily decorate your method calls with laravel-decorator package
Stars: ✭ 125 (+19.05%)
Mutual labels:  decorator
pyplugs
Decorator based plugin architecture for Python
Stars: ✭ 56 (-46.67%)
Mutual labels:  decorator
check-all
Multiple checkbox selection helper.
Stars: ✭ 70 (-33.33%)
Mutual labels:  decorator
oh-my-design-patterns
🎨 Record the articles and code I wrote while learning design patterns
Stars: ✭ 33 (-68.57%)
Mutual labels:  decorator
Decor.NET
A simple way to decorate a class with additional functionality using attributes.
Stars: ✭ 29 (-72.38%)
Mutual labels:  decorator
burgundy
A simple wrapper for objects (think of Burgundy as a decorator/presenter) in less than 150 lines.
Stars: ✭ 48 (-54.29%)
Mutual labels:  decorator
discord-nestjs
👾 NestJS package for discord.js
Stars: ✭ 173 (+64.76%)
Mutual labels:  decorator
typescript-retry-decorator
lightweight typescript retry decorator with 0 dependency.
Stars: ✭ 50 (-52.38%)
Mutual labels:  decorator
performance-decorator
🏇User behavior & Function execution tracking solution - 大型前端项目的用户行为跟踪,函数调用链分析,断点调试共享化和复用化实践
Stars: ✭ 39 (-62.86%)
Mutual labels:  decorator
typescript-lazy-get-decorator
Lazily evaluates a getter on an object and caches the returned value
Stars: ✭ 33 (-68.57%)
Mutual labels:  decorator
python-valid8
Yet another validation lib ;). Provides tools for general-purpose variable validation, function inputs/outputs validation as well as class fields validation. All entry points raise consistent ValidationError including all contextual details, with dynamic inheritance of ValueError/TypeError as appropriate.
Stars: ✭ 24 (-77.14%)
Mutual labels:  decorator
react-reflorp
Basically a simple ORM using Refetch, but the data is stored in Redux. Feel free to open an issue if you have a question or feature request.
Stars: ✭ 45 (-57.14%)
Mutual labels:  decorator
strongtyping
Decorator which checks whether the function is called with the correct type of parameters.
Stars: ✭ 85 (-19.05%)
Mutual labels:  decorator
combobox-nav
Attach combobox navigation behavior to <input> or <textarea>.
Stars: ✭ 76 (-27.62%)
Mutual labels:  decorator
Hotkey
Trigger an action on an element with a keyboard shortcut.
Stars: ✭ 2,389 (+2175.24%)
Mutual labels:  decorator
python-makefun
Dynamically create python functions with a proper signature.
Stars: ✭ 62 (-40.95%)
Mutual labels:  decorator

Session Resume

Annotate fields to be persisted on navigation away from the current page. Fields will be automatically restored when the user revisits the page again in their current browser session (excludes separate tabs).

Not designed 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].