Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabioricali/spyo
Observe an object, check when it's change.
https://github.com/fabioricali/spyo
changed observer watching
Last synced: 22 days ago
JSON representation
Observe an object, check when it's change.
- Host: GitHub
- URL: https://github.com/fabioricali/spyo
- Owner: fabioricali
- License: mit
- Created: 2018-02-06T17:53:34.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-13T16:15:03.000Z (almost 7 years ago)
- Last Synced: 2024-10-09T21:35:06.567Z (3 months ago)
- Topics: changed, observer, watching
- Language: JavaScript
- Homepage:
- Size: 132 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.hbs
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Spyo
Observe an object, check when it's change.## Installation
### Node.js
```
npm install spyo --save
```### Browser
#### Local
```html```
#### CDN unpkg
```html```
## Example
```javascript
const Spyo = require('spyo');const myObject = {
firstName: 'Mike',
lastName: 'Red'
};const mySpy = new Spyo(myObject);
myObject.firstName = 'John';
mySpy.onChange((different) => {
console.log('is different:', different);
});
```## Use provider function
```javascript
const mySpy = new Spyo(() => {
return Math.random();
});mySpy.onChange((different) => {
console.log('is different:', different);
});
```## API
{{>main}}
## Changelog
You can view the changelog here## License
Spyo is open-sourced software licensed under the MIT license## Author
Fabio Ricali