0.1.1 • Published 8 years ago

arida v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Introduction

A libabry for subcribing data what you'r interesting. when the part of data what you have subcibed has changed, the callback you have registered will be triggered. This is a data flow libary extends flux or reflux, you can pass data from compontents to its children or sibings.

Install

npm install arida

Usage example

import arida from 'arida';
const source = {name: 'aa', id: 2, dept: 'math'};
arida.init(source);
arida.subcribe(['name', 'id'], (payload) => {
  console.log(payload);
});
arida.update({
  name: 'lucy',
});
arida.update({
  dept: 'chinese',
});

Run the example above, you will get {name: 'lucy'} on your console.

API

The following is an incomplete list of arida API. It should give you a general concept of arida's usage.

  • .init(object): Returns target object;
  • .subcribe(keys, callback): subcribe the key(string) or keys(array), even an object that you'r interesting;
  • .update(data): update date and dispatch its changes to observers;
  • .get(): Returns target object;

Contributing

We welcome all contributions, please submit any ideas as pull requests or as a GitHub issue.

Licence

MIT

0.1.1

8 years ago

0.1.0

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago