Sha256: f089d08af63c91c2752b482f89c8b2505e5a585eda155b07588b2a445ad35ad4

Contents?: true

Size: 851 Bytes

Versions: 59

Compression:

Stored size: 851 Bytes

Contents

var bind = (window.addEventListener !== undefined) ? 'addEventListener' : 'attachEvent',
    unbind = (window.removeEventListener !== undefined) ? '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

59 entries across 59 versions & 1 rubygems

Version Path
ende-0.4.25 vendor/components/component-event/index.js
ende-0.4.24 vendor/components/component-event/index.js
ende-0.4.23 vendor/components/component-event/index.js
ende-0.4.22 vendor/components/component-event/index.js
ende-0.4.21 vendor/components/component-event/index.js
ende-0.5.0 vendor/components/component-event/index.js
ende-0.4.20 vendor/components/component-event/index.js
ende-0.4.19 vendor/components/component-event/index.js
ende-0.4.18 vendor/components/component-event/index.js
ende-0.4.17 vendor/components/component-event/index.js
ende-0.4.16 vendor/components/component-event/index.js
ende-0.3.13 vendor/components/component-event/index.js
ende-0.3.12 vendor/components/component-event/index.js
ende-0.3.11 vendor/components/component-event/index.js
ende-0.4.15 vendor/components/component-event/index.js
ende-0.4.14 vendor/components/component-event/index.js
ende-0.4.13 vendor/components/component-event/index.js
ende-0.4.12 vendor/components/component-event/index.js
ende-0.4.11 vendor/components/component-event/index.js
ende-0.4.10 vendor/components/component-event/index.js