Sha256: 93c3508677551303d73a03f9f5be89d430dac81eb38f53c2737e1932d77e2dc8

Contents?: true

Size: 782 Bytes

Versions: 27

Compression:

Stored size: 782 Bytes

Contents

/**
 * 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){
  if (el.addEventListener) {
    el.addEventListener(type, fn, capture || false);
  } else {
    el.attachEvent('on' + type, fn);
  }
  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){
  if (el.removeEventListener) {
    el.removeEventListener(type, fn, capture || false);
  } else {
    el.detachEvent('on' + type, fn);
  }
  return fn;
};

Version data entries

27 entries across 14 versions & 1 rubygems

Version Path
ende-0.2.3 vendor/assets/components/component-event/index.js
ende-0.2.3 vendor/components/component-event/index.js
ende-0.2.2 vendor/assets/components/component-event/index.js
ende-0.2.2 vendor/components/component-event/index.js
ende-0.2.1 vendor/assets/components/component-event/index.js
ende-0.2.1 vendor/components/component-event/index.js
ende-0.2.0 vendor/components/component-event/index.js
ende-0.2.0 vendor/assets/components/component-event/index.js
ende-0.1.14 vendor/assets/components/component-event/index.js
ende-0.1.14 vendor/components/component-event/index.js
ende-0.1.13 vendor/components/component-event/index.js
ende-0.1.13 vendor/assets/components/component-event/index.js
ende-0.1.12 vendor/components/component-event/index.js
ende-0.1.12 vendor/assets/components/component-event/index.js
ende-0.1.11 vendor/components/component-event/index.js
ende-0.1.11 vendor/assets/components/component-event/index.js
ende-0.1.10 vendor/assets/components/component-event/index.js
ende-0.1.10 vendor/components/component-event/index.js
ende-0.1.9 vendor/components/component-event/index.js
ende-0.1.9 vendor/assets/components/component-event/index.js