Simple tool for declarative binding applications to HTML nodes.
$ npm install bazooka
Bazooka uses MutationObserver
to watch for DOM updates. If you want to use Baz.watch()
and need to support browsers without MutationObserver
, you'll need any MutationObserver
polyfill (we recommend this one)
Also, Bazooka can initiate components asynchriously (when component's node comes into viewport, via data-baz-async="viewport"
HTML attribute). For that, Bazooka uses IntersectionObserver
. In browsers without IntersectionObserver
support, falls back to the equivalent of setTimeout(bazFunc, 1, node)
To view the examples, clone the bazooka repo, install the dependencies and compile examples:
$ git clone git://github.com/seedofjoy/bazooka.git
$ cd bazooka
$ npm install
$ npm run examples
Then run whichever example you want by opening index.html in /examples/
subdirectories:
$ cd examples
- complex — universal component to work with and without bazooka
- react-basic — bazooka + react
- gifflix — bazooka + frp (via kefir.js)
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
Bazooka uses prettier linter. To conform with it, just run before creating a commit:
$ npm run fmt