bazooka
v0.9.1
Published
Simple tool for declarative binding applications to HTML nodes.
Downloads
1,545
Readme
bazooka
Simple tool for declarative binding applications to HTML nodes.
Installation
$ npm install bazooka
Browser Support
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)
Examples
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)
Docs
Changelog
Tests
To run the test suite, first install the dependencies, then run npm test
:
$ npm install
$ npm test
Lint
Bazooka uses prettier linter. To conform with it, just run before creating a commit:
$ npm run fmt