Sha256: 979550978c890e1042b05518e2eaf0bb288d9a5eacfa03bea78d50eec63092f9
Contents?: true
Size: 827 Bytes
Versions: 44
Compression:
Stored size: 827 Bytes
Contents
module.exports = { once: function(el, type, callback) { var typeArray = type.split(' '); var recursiveFunction = function(e){ e.target.removeEventListener(e.type, recursiveFunction); return callback(e); }; for (var i = typeArray.length - 1; i >= 0; i--) { this.on(el, typeArray[i], recursiveFunction); } }, // IE8+ Support on: function(el, type, callback) { if(el.addEventListener) { el.addEventListener(type, callback); } else { el.attachEvent('on' + type, function() { callback.call(el); }); } }, // IE8+ Support off: function(el, type, callback) { if(el.removeEventListener) { el.removeEventListener(type, callback); } else { el.detachEvent('on' + type, callback); } } };
Version data entries
44 entries across 44 versions & 1 rubygems