Sha256: 55779353370c12ae40b68eaf0add0369777e6c65c75b474525d8b57f01b046fd

Contents?: true

Size: 815 Bytes

Versions: 6

Compression:

Stored size: 815 Bytes

Contents

var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
    unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
    prefix = bind !== 'addEventListener' ? 'on' : '';

/**
 * Bind `el` event `type` to `fn`.
 *
 * @param {Element} el
 * @param {String} type
 * @param {Function} fn
 * @param {Boolean} capture
 * @return {Function}
 * @api public
 */

exports.bind = function(el, type, fn, capture){
  el[bind](prefix + type, fn, capture || false);
  return fn;
};

/**
 * Unbind `el` event `type`'s callback `fn`.
 *
 * @param {Element} el
 * @param {String} type
 * @param {Function} fn
 * @param {Boolean} capture
 * @return {Function}
 * @api public
 */

exports.unbind = function(el, type, fn, capture){
  el[unbind](prefix + type, fn, capture || false);
  return fn;
};

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ende-0.5.6 components/component/event/0.1.3/index.js
ende-0.5.5 components/component/event/0.1.3/index.js
ende-0.5.4 components/component/event/0.1.3/index.js
ende-0.5.3 components/component/event/0.1.3/index.js
ende-0.5.2 components/component/event/0.1.3/index.js
ende-0.5.1 components/component/event/0.1.3/index.js