New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

localsync

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localsync

a lightweight module to sync JS objects in realtime across tabs / windows of a browser.

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.8K
decreased by-53.32%
Maintainers
1
Weekly downloads
 
Created
Source

localsync

a lightweight module to sync JS objects in realtime across tabs / windows of a browser. Uses local storage event emitters and falls back to cookie polling if using an unsupported browser (IE 9+ / Edge). Isomorphic. Tested with mocha.

NPM

Install

npm i -S localsync

How to use

import localsync from 'localsync'

const action = username => username
const handler = (value, old, url) => {
  console.info(`Another tab at url ${url} had username updated from ${old.username} to ${value.username}.`)
}

const usernameSync = localsync('username', action, handler)

usernameSync.start()

usernameSync.trigger('jim')

setTimeout(() => {
  usernameSync.trigger('jane')
}, 5000)

setTimeout(() => {
  if(usernameSync.isRunning)
    usernameSync.stop()
}, 10000)

Keywords

FAQs

Package last updated on 02 Jun 2016

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