Socket
Socket
Sign inDemoInstall

backbone.storagesync

Package Overview
Dependencies
2
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    backbone.storagesync

Backbone Sync to Web Storage.


Version published
Weekly downloads
17
increased by1600%
Maintainers
1
Install size
1.00 MB
Created
Weekly downloads
 

Readme

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

Last updated on 12 Apr 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc