https://github.com/jondotsoy/vls
Vls Persistent Data Flux
https://github.com/jondotsoy/vls
Last synced: about 2 months ago
JSON representation
Vls Persistent Data Flux
- Host: GitHub
- URL: https://github.com/jondotsoy/vls
- Owner: JonDotsoy
- License: mit
- Created: 2016-12-21T02:20:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-24T15:23:26.000Z (over 8 years ago)
- Last Synced: 2025-01-26T10:30:16.662Z (4 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/vls
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VLS
VLS is a persistent object *similar to [Map][map-object]*.## Quick start
##### Using NPM
npm install --save vls
##### Using unpkg CDN
## Docs and examples
- [API](./docs/API.md)
- [Examples](#examples)
- Documentation
- Basic usage## Examples
### One example similar to a Map Object
```javascript
const myVls = new VlsmyVls.set('key1', 'value to key1')
myVls.set('key2', 'value to key2')
myVls.set('key3', 'value to key3')console.log(myVls.get('key3')) // value to key3
```### Find a value
```javascript
const myVls = new VlsmyVls.set('key1', {v: 9,text:'value to key1'})
myVls.set('key2', {v: 3,text:'value to key2'})
myVls.set('key3', {v: 7,text:'value to key3'})const myResult = myVls.find(function (value, index) {
return value.v === 9
})console.log(myResult) // {v: 3,text:'value to key2'}
```### References on ReactJS
> See it https://facebook.github.io/react/docs/refs-and-the-dom.html
```javascript
class myComponent extends React.Component {
constructor(props) {
super(props)this.ref = Vls()
}updateValue() {
const value = this.ref('input').value
this.setState({value})
}handleUpdateInput (event) {
this.updateValue()
}render () {
this.ref.clear()
const refd = this.ref.definereturn
{String(this.state.value)}
}
}
```[map-object]: https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Map