Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rjz/frumpy
A tiny JS event dispatcher
https://github.com/rjz/frumpy
Last synced: 17 days ago
JSON representation
A tiny JS event dispatcher
- Host: GitHub
- URL: https://github.com/rjz/frumpy
- Owner: rjz
- Created: 2014-05-18T03:33:25.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-03T05:50:38.000Z (about 10 years ago)
- Last Synced: 2024-10-22T12:06:01.473Z (2 months ago)
- Language: JavaScript
- Size: 281 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Frumpy
A tiny (<1k) event dispatcher with very few features and opinions.
[http://rjz.github.io/frumpy](http://rjz.github.io/frumpy)
[![Build
Status](https://travis-ci.org/rjz/frumpy.svg)](https://travis-ci.org/rjz/frumpy)### Example
Write some routines that interact with the application model.
function log (model) {
// No return value; model will not be updated.
console.log(model);
}function ticking (model) {
// Update the model
return Frumpy.copy(model, {
foo: model.foo + 5
});
}Then create an instance of `Frumpy` and wire it up:
var model = { foo: 0 };
var handlers = [
[ 'tikTok', ticking ],
[ 'model:change', log ]
];var f = new Frumpy(model, handlers);
setInterval(f.as('tikTok'), 500);
### Usage
$ npm install && bower install
Launch a server at http://localhost:3277
$ npm start
### Tests
$ npm test
### License
[WTFPL](http://www.wtfpl.net/)