first commit
This commit is contained in:
77
bootstrap/node_modules/css-emitter-component/index.js
generated
vendored
Normal file
77
bootstrap/node_modules/css-emitter-component/index.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Module Dependencies
|
||||
*/
|
||||
|
||||
var events = require('event');
|
||||
|
||||
// CSS events
|
||||
|
||||
var watch = [
|
||||
'transitionend'
|
||||
, 'webkitTransitionEnd'
|
||||
, 'oTransitionEnd'
|
||||
, 'MSTransitionEnd'
|
||||
, 'animationend'
|
||||
, 'webkitAnimationEnd'
|
||||
, 'oAnimationEnd'
|
||||
, 'MSAnimationEnd'
|
||||
];
|
||||
|
||||
/**
|
||||
* Expose `CSSnext`
|
||||
*/
|
||||
|
||||
module.exports = CssEmitter;
|
||||
|
||||
/**
|
||||
* Initialize a new `CssEmitter`
|
||||
*
|
||||
*/
|
||||
|
||||
function CssEmitter(element){
|
||||
if (!(this instanceof CssEmitter)) return new CssEmitter(element);
|
||||
this.el = element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind CSS events.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
CssEmitter.prototype.bind = function(fn){
|
||||
for (var i=0; i < watch.length; i++) {
|
||||
events.bind(this.el, watch[i], fn);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Unbind CSS events
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
CssEmitter.prototype.unbind = function(fn){
|
||||
for (var i=0; i < watch.length; i++) {
|
||||
events.unbind(this.el, watch[i], fn);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fire callback only once
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
CssEmitter.prototype.once = function(fn){
|
||||
var self = this;
|
||||
function on(){
|
||||
self.unbind(on);
|
||||
fn.apply(self.el, arguments);
|
||||
}
|
||||
self.bind(on);
|
||||
return this;
|
||||
};
|
||||
|
Reference in New Issue
Block a user