Bind functions to transition
and animation
events.
$ component install anthonyshort/css-emitter
or via npm for Browserify
$ npm install css-emitter-component
var css = require('css-emitter');
var el = document.querySelector('#box');
var animate = css(el);
// Bind
animate.bind(function(e){
console.log('%s property changed on %s event', e.propertyName, e.type);
});
// Change height and width
setTimeout(function(){
el.className = 'in';
}, 1000);
#box {
width: 100px;
height: 100px;
transition: all 1s ease;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
background: black;
display: block;
}
#box.in {
width: 200px;
height: 200px;
}
Initialize an CssEmitter
with given target
element.
Register bind function.
Unregister bind function.
Register a function that will fire once then unbind automatically
MIT