Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DiegoRBaquero/node-v
π Secure βοΈ Synchronized β‘οΈ Realtime βοΈ Cloud π Native JavaScript Variables & Events
https://github.com/DiegoRBaquero/node-v
cloud constants es6 javascript proxy realtime sync synchronization variables
Last synced: 9 days ago
JSON representation
π Secure βοΈ Synchronized β‘οΈ Realtime βοΈ Cloud π Native JavaScript Variables & Events
- Host: GitHub
- URL: https://github.com/DiegoRBaquero/node-v
- Owner: DiegoRBaquero
- License: mit
- Created: 2017-01-01T18:06:48.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-30T19:13:09.000Z (over 2 years ago)
- Last Synced: 2024-05-21T12:51:21.617Z (6 months ago)
- Topics: cloud, constants, es6, javascript, proxy, realtime, sync, synchronization, variables
- Language: JavaScript
- Homepage:
- Size: 434 KB
- Stars: 28
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
π Secure βοΈ Synchronized β‘οΈ Realtime βοΈ Cloud π Native JavaScript Variables & Events
V 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.
### Current Features
- Keep your variables in the cloud
- Sync variables between instances
- Automatic reloaded/rehydrated on start-up#### Requires ES6 Proxy (Node 6+ and new browsers)
### Coming Soon:
- Web GUI
- History - Time machine
- Events pub/sub## Install
### Node
```sh
npm install --save v
or
npm i -S v
```### Browser
jsDelivr CDN:
```html```
Unpkg CDN:
```html```
More CDNs coming soon
## API
### Constructor (3 Ways to do it)
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: 'ws(s)://my-domain.com'
}
```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')
```## License
MIT Copyright Β© [Diego RodrΓguez Baquero](https://diegorbaquero.com)