Secure, Synchronized, Realtime, Cloud, Native JavaScript Variables & Events
npm install vV extends your in-memory variables to also be saved/persisted instantly. Variables are instantly synchronized between all running instances of V in a room. When you (re)start in a room, variables and constants are reloaded/rehydrated automatically.
#### Requires ES6 Proxy (Node 6+ and new browsers)
sh
npm install --save v
or
npm i -S v
`$3
Unpkg CDN:
`html
`More CDNs coming soon
API
$3
If no roomId is passed, a new one will be assigned automatically and printed in the console.
##### NodeJS only with deasync support
`js
const V = require('v')
const v = new V([roomId])
`##### Callback
`js
const V = require('v')
V([roomId,] v => {})
`##### Promise
`js
const V = require('v')
V([roomId]).then(v => {}).catch(e => {
})
`#### Custom Opts
The
opts object has the following options and their default options listed
`js
myOpts = {
roomId: '',
server: 'wss://api.online.vars'
}
`Use it:
`js
const v = new V(myOpts)
`Debug logs
V comes with extensive debugging logs. Each V instance and constructor-call has it own debug namespace.
In node, enable debug logs by setting the
DEBUG environment variable to *`bash
DEBUG=* node myProgram.js
`In the browser, enable debug logs by running this in the developer console:
`js
localStorage.debug = '*'
`Disable by running this:
`js
localStorage.removeItem('debug')
``