Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Reordered functions

  • Loading branch information...
commit ecf6417041b88477c3179b1c2c88125a0af61aaa 1 parent c0b1aa6
@jpdery authored
Showing with 88 additions and 88 deletions.
  1. +48 −48 lib/tap.js
  2. +39 −39 touch-util.js
  3. +1 −1  touch-util.min.js
View
96 lib/tap.js
@@ -37,6 +37,54 @@ var append = function(parent, object) {
return merge
}
+var attach = function(name, func) {
+ return function() {
+ this.addEventListener(name, func)
+ }
+}
+
+var detach = function(name, func) {
+ return function() {
+ this.removeEventListener(name, func)
+ }
+}
+
+var storage = function(element, touch) {
+ var data = map.get(element)
+ if (!data) map.set(element, (data = {}))
+ return data
+}
+
+var enters = function(element, touch) {
+ var data = storage(element)
+ var name = touch.identifier
+ if (data[name] === undefined ||
+ data[name] === 'out') {
+ data[name] = 'in'
+ return true
+ }
+ return false
+}
+
+var leaves = function(element, touch) {
+ var data = storage(element)
+ var name = touch.identifier
+ if (data[name] === undefined ||
+ data[name] === 'in') {
+ data[name] = 'out'
+ return true
+ }
+ return false
+}
+
+var enter = function(e) {
+ this.dispatchEvent('tapenter', e)
+}
+
+var leave = function(e) {
+ this.dispatchEvent('tapleave', e)
+}
+
var custom = {onDispatch: onDispatch}
defineCustomEvent('tapstart', append(custom, {
@@ -91,54 +139,6 @@ defineCustomEvent('tapoutside', append(custom, {
}
}))
-var attach = function(name, func) {
- return function() {
- this.addEventListener(name, func)
- }
-}
-
-var detach = function(name, func) {
- return function() {
- this.removeEventListener(name, func)
- }
-}
-
-var storage = function(element, touch) {
- var data = map.get(element)
- if (!data) map.set(element, (data = {}))
- return data
-}
-
-var enters = function(element, touch) {
- var data = storage(element)
- var name = touch.identifier
- if (data[name] === undefined ||
- data[name] === 'out') {
- data[name] = 'in'
- return true
- }
- return false
-}
-
-var leaves = function(element, touch) {
- var data = storage(element)
- var name = touch.identifier
- if (data[name] === undefined ||
- data[name] === 'in') {
- data[name] = 'out'
- return true
- }
- return false
-}
-
-var enter = function(e) {
- this.dispatchEvent('tapenter', e)
-}
-
-var leave = function(e) {
- this.dispatchEvent('tapleave', e)
-}
-
defineCustomEvent('tapenter', append(custom, {
base: 'tapinside',
condition: function(e) {
View
78 touch-util.js
@@ -141,6 +141,45 @@
for (var k in object) merge[k] = object[k];
return merge;
};
+ var attach = function(name, func) {
+ return function() {
+ this.addEventListener(name, func);
+ };
+ };
+ var detach = function(name, func) {
+ return function() {
+ this.removeEventListener(name, func);
+ };
+ };
+ var storage = function(element, touch) {
+ var data = map.get(element);
+ if (!data) map.set(element, data = {});
+ return data;
+ };
+ var enters = function(element, touch) {
+ var data = storage(element);
+ var name = touch.identifier;
+ if (data[name] === undefined || data[name] === "out") {
+ data[name] = "in";
+ return true;
+ }
+ return false;
+ };
+ var leaves = function(element, touch) {
+ var data = storage(element);
+ var name = touch.identifier;
+ if (data[name] === undefined || data[name] === "in") {
+ data[name] = "out";
+ return true;
+ }
+ return false;
+ };
+ var enter = function(e) {
+ this.dispatchEvent("tapenter", e);
+ };
+ var leave = function(e) {
+ this.dispatchEvent("tapleave", e);
+ };
var custom = {
onDispatch: onDispatch
};
@@ -189,45 +228,6 @@
return outside(touch.pageX, touch.pageY, this);
}
}));
- var attach = function(name, func) {
- return function() {
- this.addEventListener(name, func);
- };
- };
- var detach = function(name, func) {
- return function() {
- this.removeEventListener(name, func);
- };
- };
- var storage = function(element, touch) {
- var data = map.get(element);
- if (!data) map.set(element, data = {});
- return data;
- };
- var enters = function(element, touch) {
- var data = storage(element);
- var name = touch.identifier;
- if (data[name] === undefined || data[name] === "out") {
- data[name] = "in";
- return true;
- }
- return false;
- };
- var leaves = function(element, touch) {
- var data = storage(element);
- var name = touch.identifier;
- if (data[name] === undefined || data[name] === "in") {
- data[name] = "out";
- return true;
- }
- return false;
- };
- var enter = function(e) {
- this.dispatchEvent("tapenter", e);
- };
- var leave = function(e) {
- this.dispatchEvent("tapleave", e);
- };
defineCustomEvent("tapenter", append(custom, {
base: "tapinside",
condition: function(e) {
View
2  touch-util.min.js
@@ -1 +1 @@
-(function(a){var b={},c=function(d){var e=b[d];if(!e){e=b[d]={};var f=e.exports={};a[d].call(f,c,e,f,window)}return e.exports};window["touch-util"]=c("0")})({0:function(a,b,c,d){"use strict",a("1"),a("2")},1:function(a,b,c,d){"use strict";var e="ontouchstart"in d,f="TouchList"in d,g="Touch"in d;if(!f){var h=function(){this.length=0};h.prototype.identifiedTouch=function(a){return this[0]&&this[0].identifier===a?this[0]:null},h.prototype.item=function(a){return this[a]||null}}if(!g)var i=function(){};var j=null,k=null,l=function(a){if(k===null){k=a.target,j=new i,j.identifier=Date.now(),j.screenX=a.screenX,j.screenY=a.screenY,j.clientX=a.clientX,j.clientY=a.clientY,j.pageX=a.pageX,j.pageY=a.pageY,j.radiusX=0,j.radiusY=0,j.rotationAngle=0,j.force=0,j.target=k;var b=new h;b.length=1,b[0]=j;var c=document.createEvent("CustomEvent");c.initCustomEvent("touchstart",!0,!0),c.touches=b,c.targetTouches=b,c.changedTouches=b,k.dispatchEvent(c)}},m=function(a){if(k){j.screenX=a.screenX,j.screenY=a.screenY,j.clientX=a.clientX,j.clientY=a.clientY,j.pageX=a.pageX,j.pageY=a.pageY;var b=new h;b.length=1,b[0]=j;var c=document.createEvent("CustomEvent");c.initCustomEvent("touchmove",!0,!0),c.touches=b,c.targetTouches=b,c.changedTouches=b,k.dispatchEvent(c)}},n=function(a){if(k){j.screenX=a.screenX,j.screenY=a.screenY,j.clientX=a.clientX,j.clientY=a.clientY,j.pageX=a.pageX,j.pageY=a.pageY;var b=new h;b.length=1,b[0]=j;var c=document.createEvent("CustomEvent");c.initCustomEvent("touchend",!0,!0),c.touches=new h,c.targetTouches=new h,c.changedTouches=b,k.dispatchEvent(c),k=null}};e||(document.addEventListener("mousedown",l),document.addEventListener("mousemove",m),document.addEventListener("mouseup",n))},2:function(a,b,c,d){"use strict";var e=a("3")(),f=a("4"),g=function(a,b){a.view=b.view,a.touches=b.touches,a.targetTouches=b.targetTouches,a.changedTouches=b.changedTouches,a.ctrlKey=b.ctrlKey,a.shiftKey=b.shiftKey,a.altKey=b.altKey,a.metaKey=b.metaKey},h=function(a,b){return a===b||a.contains(b)},i=function(a,b,c){var d=document.elementFromPoint(a,b);return d?h(c,d):!1},j=function(a,b,c){var d=document.elementFromPoint(a,b);return d?!h(c,d):!0},k=function(a,b){var c={};for(var d in a)c[d]=a[d];for(var d in b)c[d]=b[d];return c},l={onDispatch:g};f("tapstart",k(l,{base:"touchstart",condition:function(a){return a.targetTouches.length===1}})),f("tapmove",k(l,{base:"touchmove",condition:function(a){return a.targetTouches[0]===a.changedTouches[0]}})),f("tapend",k(l,{base:"touchend",condition:function(a){return a.targetTouches.length===0}})),f("tapcancel",k(l,{base:"touchcancel",condition:function(a){return!0}})),f("tap",k(l,{base:"tapend",condition:function(a){var b=a.changedTouches[0];return i(b.pageX,b.pageY,this)}})),f("tapinside",k(l,{base:"tapmove",condition:function(a){var b=a.targetTouches[0];return i(b.pageX,b.pageY,this)}})),f("tapoutside",k(l,{base:"tapmove",condition:function(a){var b=a.targetTouches[0];return j(b.pageX,b.pageY,this)}}));var m=function(a,b){return function(){this.addEventListener(a,b)}},n=function(a,b){return function(){this.removeEventListener(a,b)}},o=function(a,b){var c=e.get(a);return c||e.set(a,c={}),c},p=function(a,b){var c=o(a),d=b.identifier;return c[d]===undefined||c[d]==="out"?(c[d]="in",!0):!1},q=function(a,b){var c=o(a),d=b.identifier;return c[d]===undefined||c[d]==="in"?(c[d]="out",!0):!1},r=function(a){this.dispatchEvent("tapenter",a)},s=function(a){this.dispatchEvent("tapleave",a)};f("tapenter",k(l,{base:"tapinside",condition:function(a){return p(this,a.targetTouches[0])},onAdd:m("tapstart",r),onRemove:n("tapstart",r)})),f("tapleave",k(l,{base:"tapoutside",condition:function(a){return q(this,a.targetTouches[0])},onAdd:m("tapend",s),onRemove:n("tapend",s)}))},3:function(require,module,exports,global){void function(a,b,c){function j(a,b,c){return typeof b=="function"&&(c=b,b=k(c).replace(/_$/,"")),e(a,b,{configurable:!0,writable:!0,value:c})}function k(a){return typeof a!="function"?"":"name"in a?a.name:f.call(a).match(i)[1]}function o(a){function d(d,e){return e||arguments.length===2?b.set(d,e):(e=b.get(d),e===c&&(e=a(d),b.set(d,e))),e}var b=new m;return a||(a=n),d}var d=Object.getOwnPropertyNames,e=Object.defineProperty,f=Function.prototype.toString,g=Object.create,h=Object.prototype.hasOwnProperty,i=/^\n?function\s?(\w*)?_?\(/,l=function(){function m(){var c=i(),d={};this.unlock=function(f){var i=l(f);if(h.call(i,c))return i[c](d);var j=g(null,a);return e(i,c,{value:(new Function("s","l",b))(d,j)}),j}}var a={value:{writable:!0,value:c}},b="return function(k){if(k===s)return l}",f=g(null),i=function(){var a=Math.random().toString(36).slice(2);return a in f?i():f[a]=a},k=i(),l=function(a){if(h.call(a,k))return a[k];if(!Object.isExtensible(a))throw new TypeError("Object must be extensible");var b=g(null);return e(a,k,{value:b}),b};return j(Object,function(b){var c=d(b);return h.call(b,k)&&c.splice(c.indexOf(k),1),c}),j(m.prototype,function(b){return this.unlock(b).value}),j(m.prototype,function(b,c){this.unlock(b).value=c}),m}(),m=function(d){function i(b){if(this===a||this==null||this===i.prototype)return new i(b);f(this,new l),h(this,b)}function m(a){e(a);var d=g(this).get(a);return d===b?c:d}function n(a,d){e(a),g(this).set(a,d===c?b:d)}function o(a){return e(a),g(this).get(a)!==c}function p(a){e(a);var b=g(this),d=b.get(a)!==c;return b.set(a,c),d}function q(){return g(this),"[object WeakMap]"}var e=function(a){if(a==null||typeof a!="object"&&typeof a!="function")throw new TypeError("Invalid WeakMap key")},f=function(a,b){var c=d.unlock(a);if(c.value)throw new TypeError("Object is already a WeakMap");c.value=b},g=function(a){var b=d.unlock(a).value;if(!b)throw new TypeError("WeakMap is not generic");return b},h=function(a,b){b!==null&&typeof b=="object"&&typeof b.forEach=="function"&&b.forEach(function(c,d){c instanceof Array&&c.length===2&&n.call(a,b[d][0],b[d][1])})};try{var r=("return "+p).replace("e_","\\u0065"),s=(new Function("unwrap","validate",r))(g,e)}catch(t){var s=p}var r=(""+Object).split("Object"),u=function w(){return r[0]+k(this)+r[1]};j(u,u);var v={__proto__:[]}instanceof Array?function(a){a.__proto__=u}:function(a){j(a,u)};return v(i),[q,m,n,o,s].forEach(function(a){j(i.prototype,a),v(a)}),i}(new l),n=Object.create?function(){return Object.create(null)}:function(){return{}};typeof module!="undefined"?module.exports=m:typeof exports!="undefined"?exports.WeakMap=m:"WeakMap"in a||(a.WeakMap=m),m.createStorage=o,a.WeakMap&&(a.WeakMap.createStorage=o)}((0,eval)("this"))},4:function(a,b,c,d){"use strict";var e=a("3").createStorage(),f={},g=Element.prototype.dispatchEvent,h=Element.prototype.addEventListener,i=Element.prototype.removeEventListener;Element.prototype.dispatchEvent=function(a,b){var c=f[a];if(c){b=b||{};if(n(c.condition,this,b))return;var d=a;a=document.createEvent("CustomEvent"),a.initCustomEvent(d,c.bubbleable,c.cancelable),c.onDispatch.call(this,a,b)}return g.call(this,a)},Element.prototype.addEventListener=function(a,b,c){var d=f[a];if(d){d.onAdd.call(this),b=r(this,a,b);var e=l(d);e&&h.call(this,e,q(this,a,b),c)}return h.call(this,a,b,c)},Element.prototype.removeEventListener=function(a,b,c){var d=f[a];if(d){d.onRemove.call(this),b=r(this,a,b);var e=l(d);e&&i.call(this,e,q(this,a,b),c),p(this,a,b)}return i.call(this,a,b,c)};var j=function(a,b){b.base="base"in b?b.base:null,b.condition="condition"in b?b.condition:!0,b.bubbleable="bubbleable"in b?b.bubbleable:!0,b.cancelable="cancelable"in b?b.cancelable:!0,b.onAdd=b.onAdd||function(){},b.onRemove=b.onRemove||function(){},b.onDispatch=b.onDispatch||function(){};var c=f[b.base],d=function(a){return m(c.condition,this,a)&&m(b.condition,this,a)};f[a]=c?{base:c.base,bubbleable:b.bubbleable,cancelable:b.cancelable,condition:d,onAdd:k(b,c,"onAdd"),onRemove:k(b,c,"onRemove"),onDispatch:k(b,c,"onDispatch")}:b},k=function(a,b,c){return function(){b[c].apply(this,arguments),a[c].apply(this,arguments)}},l=function(a){var b=a.base;if(b===null)return null;var c=f[b];return c?l(c):b},m=function(a,b,c){return typeof a=="function"?a.call(b,c):a},n=function(a,b,c){return!m(a,b,c)},o=function(a,b,c){var d=e(a);d[b]===undefined&&(d[b]=[]),d=d[b];for(var f=0,g=d.length;f<g;f++){var h=d[f];if(h.listener===c)return h}return h=d[d.length]={dispatch:null,validate:null,listener:c},h},p=function(a,b,c){var d=e(a);if(d[b]===undefined)return;d=d[b];for(var f=0,g=d.length;f<g;f++){var h=d[f];h.listener===c&&d.splice(f,1)}return h},q=function(a,b,c){var d=o(a,b,c);return d.dispatch===null&&(d.dispatch=function(c){a.dispatchEvent(b,c)}),d.dispatch},r=function(a,b,c){var d=o(a,b,c);return d.validate===null&&(d.validate=function(a){a instanceof CustomEvent&&c.call(this,a)}),d.validate};b.exports=d.defineCustomEvent=j}})
+(function(a){var b={},c=function(d){var e=b[d];if(!e){e=b[d]={};var f=e.exports={};a[d].call(f,c,e,f,window)}return e.exports};window["touch-util"]=c("0")})({0:function(a,b,c,d){"use strict",a("1"),a("2")},1:function(a,b,c,d){"use strict";var e="ontouchstart"in d,f="TouchList"in d,g="Touch"in d;if(!f){var h=function(){this.length=0};h.prototype.identifiedTouch=function(a){return this[0]&&this[0].identifier===a?this[0]:null},h.prototype.item=function(a){return this[a]||null}}if(!g)var i=function(){};var j=null,k=null,l=function(a){if(k===null){k=a.target,j=new i,j.identifier=Date.now(),j.screenX=a.screenX,j.screenY=a.screenY,j.clientX=a.clientX,j.clientY=a.clientY,j.pageX=a.pageX,j.pageY=a.pageY,j.radiusX=0,j.radiusY=0,j.rotationAngle=0,j.force=0,j.target=k;var b=new h;b.length=1,b[0]=j;var c=document.createEvent("CustomEvent");c.initCustomEvent("touchstart",!0,!0),c.touches=b,c.targetTouches=b,c.changedTouches=b,k.dispatchEvent(c)}},m=function(a){if(k){j.screenX=a.screenX,j.screenY=a.screenY,j.clientX=a.clientX,j.clientY=a.clientY,j.pageX=a.pageX,j.pageY=a.pageY;var b=new h;b.length=1,b[0]=j;var c=document.createEvent("CustomEvent");c.initCustomEvent("touchmove",!0,!0),c.touches=b,c.targetTouches=b,c.changedTouches=b,k.dispatchEvent(c)}},n=function(a){if(k){j.screenX=a.screenX,j.screenY=a.screenY,j.clientX=a.clientX,j.clientY=a.clientY,j.pageX=a.pageX,j.pageY=a.pageY;var b=new h;b.length=1,b[0]=j;var c=document.createEvent("CustomEvent");c.initCustomEvent("touchend",!0,!0),c.touches=new h,c.targetTouches=new h,c.changedTouches=b,k.dispatchEvent(c),k=null}};e||(document.addEventListener("mousedown",l),document.addEventListener("mousemove",m),document.addEventListener("mouseup",n))},2:function(a,b,c,d){"use strict";var e=a("3")(),f=a("4"),g=function(a,b){a.view=b.view,a.touches=b.touches,a.targetTouches=b.targetTouches,a.changedTouches=b.changedTouches,a.ctrlKey=b.ctrlKey,a.shiftKey=b.shiftKey,a.altKey=b.altKey,a.metaKey=b.metaKey},h=function(a,b){return a===b||a.contains(b)},i=function(a,b,c){var d=document.elementFromPoint(a,b);return d?h(c,d):!1},j=function(a,b,c){var d=document.elementFromPoint(a,b);return d?!h(c,d):!0},k=function(a,b){var c={};for(var d in a)c[d]=a[d];for(var d in b)c[d]=b[d];return c},l=function(a,b){return function(){this.addEventListener(a,b)}},m=function(a,b){return function(){this.removeEventListener(a,b)}},n=function(a,b){var c=e.get(a);return c||e.set(a,c={}),c},o=function(a,b){var c=n(a),d=b.identifier;return c[d]===undefined||c[d]==="out"?(c[d]="in",!0):!1},p=function(a,b){var c=n(a),d=b.identifier;return c[d]===undefined||c[d]==="in"?(c[d]="out",!0):!1},q=function(a){this.dispatchEvent("tapenter",a)},r=function(a){this.dispatchEvent("tapleave",a)},s={onDispatch:g};f("tapstart",k(s,{base:"touchstart",condition:function(a){return a.targetTouches.length===1}})),f("tapmove",k(s,{base:"touchmove",condition:function(a){return a.targetTouches[0]===a.changedTouches[0]}})),f("tapend",k(s,{base:"touchend",condition:function(a){return a.targetTouches.length===0}})),f("tapcancel",k(s,{base:"touchcancel",condition:function(a){return!0}})),f("tap",k(s,{base:"tapend",condition:function(a){var b=a.changedTouches[0];return i(b.pageX,b.pageY,this)}})),f("tapinside",k(s,{base:"tapmove",condition:function(a){var b=a.targetTouches[0];return i(b.pageX,b.pageY,this)}})),f("tapoutside",k(s,{base:"tapmove",condition:function(a){var b=a.targetTouches[0];return j(b.pageX,b.pageY,this)}})),f("tapenter",k(s,{base:"tapinside",condition:function(a){return o(this,a.targetTouches[0])},onAdd:l("tapstart",q),onRemove:m("tapstart",q)})),f("tapleave",k(s,{base:"tapoutside",condition:function(a){return p(this,a.targetTouches[0])},onAdd:l("tapend",r),onRemove:m("tapend",r)}))},3:function(require,module,exports,global){void function(a,b,c){function j(a,b,c){return typeof b=="function"&&(c=b,b=k(c).replace(/_$/,"")),e(a,b,{configurable:!0,writable:!0,value:c})}function k(a){return typeof a!="function"?"":"name"in a?a.name:f.call(a).match(i)[1]}function o(a){function d(d,e){return e||arguments.length===2?b.set(d,e):(e=b.get(d),e===c&&(e=a(d),b.set(d,e))),e}var b=new m;return a||(a=n),d}var d=Object.getOwnPropertyNames,e=Object.defineProperty,f=Function.prototype.toString,g=Object.create,h=Object.prototype.hasOwnProperty,i=/^\n?function\s?(\w*)?_?\(/,l=function(){function m(){var c=i(),d={};this.unlock=function(f){var i=l(f);if(h.call(i,c))return i[c](d);var j=g(null,a);return e(i,c,{value:(new Function("s","l",b))(d,j)}),j}}var a={value:{writable:!0,value:c}},b="return function(k){if(k===s)return l}",f=g(null),i=function(){var a=Math.random().toString(36).slice(2);return a in f?i():f[a]=a},k=i(),l=function(a){if(h.call(a,k))return a[k];if(!Object.isExtensible(a))throw new TypeError("Object must be extensible");var b=g(null);return e(a,k,{value:b}),b};return j(Object,function(b){var c=d(b);return h.call(b,k)&&c.splice(c.indexOf(k),1),c}),j(m.prototype,function(b){return this.unlock(b).value}),j(m.prototype,function(b,c){this.unlock(b).value=c}),m}(),m=function(d){function i(b){if(this===a||this==null||this===i.prototype)return new i(b);f(this,new l),h(this,b)}function m(a){e(a);var d=g(this).get(a);return d===b?c:d}function n(a,d){e(a),g(this).set(a,d===c?b:d)}function o(a){return e(a),g(this).get(a)!==c}function p(a){e(a);var b=g(this),d=b.get(a)!==c;return b.set(a,c),d}function q(){return g(this),"[object WeakMap]"}var e=function(a){if(a==null||typeof a!="object"&&typeof a!="function")throw new TypeError("Invalid WeakMap key")},f=function(a,b){var c=d.unlock(a);if(c.value)throw new TypeError("Object is already a WeakMap");c.value=b},g=function(a){var b=d.unlock(a).value;if(!b)throw new TypeError("WeakMap is not generic");return b},h=function(a,b){b!==null&&typeof b=="object"&&typeof b.forEach=="function"&&b.forEach(function(c,d){c instanceof Array&&c.length===2&&n.call(a,b[d][0],b[d][1])})};try{var r=("return "+p).replace("e_","\\u0065"),s=(new Function("unwrap","validate",r))(g,e)}catch(t){var s=p}var r=(""+Object).split("Object"),u=function w(){return r[0]+k(this)+r[1]};j(u,u);var v={__proto__:[]}instanceof Array?function(a){a.__proto__=u}:function(a){j(a,u)};return v(i),[q,m,n,o,s].forEach(function(a){j(i.prototype,a),v(a)}),i}(new l),n=Object.create?function(){return Object.create(null)}:function(){return{}};typeof module!="undefined"?module.exports=m:typeof exports!="undefined"?exports.WeakMap=m:"WeakMap"in a||(a.WeakMap=m),m.createStorage=o,a.WeakMap&&(a.WeakMap.createStorage=o)}((0,eval)("this"))},4:function(a,b,c,d){"use strict";var e=a("3").createStorage(),f={},g=Element.prototype.dispatchEvent,h=Element.prototype.addEventListener,i=Element.prototype.removeEventListener;Element.prototype.dispatchEvent=function(a,b){var c=f[a];if(c){b=b||{};if(n(c.condition,this,b))return;var d=a;a=document.createEvent("CustomEvent"),a.initCustomEvent(d,c.bubbleable,c.cancelable),c.onDispatch.call(this,a,b)}return g.call(this,a)},Element.prototype.addEventListener=function(a,b,c){var d=f[a];if(d){d.onAdd.call(this),b=r(this,a,b);var e=l(d);e&&h.call(this,e,q(this,a,b),c)}return h.call(this,a,b,c)},Element.prototype.removeEventListener=function(a,b,c){var d=f[a];if(d){d.onRemove.call(this),b=r(this,a,b);var e=l(d);e&&i.call(this,e,q(this,a,b),c),p(this,a,b)}return i.call(this,a,b,c)};var j=function(a,b){b.base="base"in b?b.base:null,b.condition="condition"in b?b.condition:!0,b.bubbleable="bubbleable"in b?b.bubbleable:!0,b.cancelable="cancelable"in b?b.cancelable:!0,b.onAdd=b.onAdd||function(){},b.onRemove=b.onRemove||function(){},b.onDispatch=b.onDispatch||function(){};var c=f[b.base],d=function(a){return m(c.condition,this,a)&&m(b.condition,this,a)};f[a]=c?{base:c.base,bubbleable:b.bubbleable,cancelable:b.cancelable,condition:d,onAdd:k(b,c,"onAdd"),onRemove:k(b,c,"onRemove"),onDispatch:k(b,c,"onDispatch")}:b},k=function(a,b,c){return function(){b[c].apply(this,arguments),a[c].apply(this,arguments)}},l=function(a){var b=a.base;if(b===null)return null;var c=f[b];return c?l(c):b},m=function(a,b,c){return typeof a=="function"?a.call(b,c):a},n=function(a,b,c){return!m(a,b,c)},o=function(a,b,c){var d=e(a);d[b]===undefined&&(d[b]=[]),d=d[b];for(var f=0,g=d.length;f<g;f++){var h=d[f];if(h.listener===c)return h}return h=d[d.length]={dispatch:null,validate:null,listener:c},h},p=function(a,b,c){var d=e(a);if(d[b]===undefined)return;d=d[b];for(var f=0,g=d.length;f<g;f++){var h=d[f];h.listener===c&&d.splice(f,1)}return h},q=function(a,b,c){var d=o(a,b,c);return d.dispatch===null&&(d.dispatch=function(c){a.dispatchEvent(b,c)}),d.dispatch},r=function(a,b,c){var d=o(a,b,c);return d.validate===null&&(d.validate=function(a){a instanceof CustomEvent&&c.call(this,a)}),d.validate};b.exports=d.defineCustomEvent=j}})
Please sign in to comment.
Something went wrong with that request. Please try again.