Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone.storagesync

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone.storagesync

Backbone Sync to Web Storage.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Backbone Storage Sync

Backbone Sync to Web Storage.

Getting Started

Replace the sync method on your model:

import storageSync from 'bacbone.storagesync';

const AwesomeModel = Backbone.Model.extend({
	sync: storageSync()
	...
})

Or with custom namespace:

const AwesomeModel = Backbone.Model.extend({
	sync: storageSync('awesome')
	...
})

Or with custom settings:

const AwesomeModel = Backbone.Model.extend({
	sync: storageSync({
		namespace: 'awesome',
		storage: window.sessionStorage
	})
	...
})

And you're good to go!

Alternative Storage

By default storagesync will use globally localStorage, however you may change it like so:

storageSync.storage = window.sessionStorage

Or if you want a fallback for when Web Storage isn't available:

storageSync.storage = new FakeStorage()

Note: this example uses my fake-storage library

Dependancies

Backbone, and Backbone.$.Deferred must be present.

License

MIT - see LICENSE

Keywords

FAQs

Package last updated on 12 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc