MCPcopy
hub / github.com/adobe-webplatform/Snap.svg / eve

Function eve

demos/snap-ad/site/js/main.js:64–124  ·  view source on GitHub ↗
(name, scope)

Source from the content-addressed store, hash-verified

62 = (object) array of returned values from the listeners
63 \*/
64 eve = function (name, scope) {
65 name = String(name);
66 var e = events,
67 oldstop = stop,
68 args = Array.prototype.slice.call(arguments, 2),
69 listeners = eve.listeners(name),
70 z = 0,
71 f = false,
72 l,
73 indexed = [],
74 queue = {},
75 out = [],
76 ce = current_event,
77 errors = [];
78 current_event = name;
79 stop = 0;
80 for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) {
81 indexed.push(listeners[i].zIndex);
82 if (listeners[i].zIndex < 0) {
83 queue[listeners[i].zIndex] = listeners[i];
84 }
85 }
86 indexed.sort(numsort);
87 while (indexed[z] < 0) {
88 l = queue[indexed[z++]];
89 out.push(l.apply(scope, args));
90 if (stop) {
91 stop = oldstop;
92 return out;
93 }
94 }
95 for (i = 0; i < ii; i++) {
96 l = listeners[i];
97 if ("zIndex" in l) {
98 if (l.zIndex == indexed[z]) {
99 out.push(l.apply(scope, args));
100 if (stop) {
101 break;
102 }
103 do {
104 z++;
105 l = queue[indexed[z]];
106 l && out.push(l.apply(scope, args));
107 if (stop) {
108 break;
109 }
110 } while (l)
111 } else {
112 queue[l.zIndex] = l;
113 }
114 } else {
115 out.push(l.apply(scope, args));
116 if (stop) {
117 break;
118 }
119 }
120 }
121 stop = oldstop;

Callers 15

stopitFunction · 0.70
frameFunction · 0.70
main.jsFile · 0.70
gradientFunction · 0.70
dragMoveFunction · 0.70
dragUpFunction · 0.70
startFunction · 0.70
svg.jsFile · 0.50
stopitFunction · 0.50
frameFunction · 0.50
animation.jsFile · 0.50
element.jsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected