Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zswang/h5observer
A simple observer.
https://github.com/zswang/h5observer
Last synced: about 1 month ago
JSON representation
A simple observer.
- Host: GitHub
- URL: https://github.com/zswang/h5observer
- Owner: zswang
- License: mit
- Created: 2017-05-13T10:30:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-15T11:54:47.000Z (over 7 years ago)
- Last Synced: 2024-08-15T05:35:10.107Z (3 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
h5observer
--------------# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coverage-image]][coverage-url]
A simple observer.
## Usage
### observer()
```js
var data = { a: 1, b: 2};h5observer.observer(data, function (model, key) {
console.log(key + ' changed.');
});
```### arrayObserver()
```js
var array = [];h5observer.arrayObserver(array, function (model, method, inserted) {
});
```### objectObserver()
```js
var data = {};h5observer.objectObserver(data, 'x', function (model, field) {
console.log(field + ' changed.');
});
```## License
MIT © [zswang](http://weibo.com/zswang)
[npm-url]: https://npmjs.org/package/h5observer
[npm-image]: https://badge.fury.io/js/h5observer.svg
[travis-url]: https://travis-ci.org/zswang/h5observer
[travis-image]: https://travis-ci.org/zswang/h5observer.svg?branch=master
[coverage-url]: https://coveralls.io/github/zswang/h5observer?branch=master
[coverage-image]: https://coveralls.io/repos/zswang/h5observer/badge.svg?branch=master&service=github