forked from jchomaz/Vulture
Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
31
VApp/node_modules/min-document/event/dispatch-event.js
generated
vendored
Normal file
31
VApp/node_modules/min-document/event/dispatch-event.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
module.exports = dispatchEvent
|
||||
|
||||
function dispatchEvent(ev) {
|
||||
var elem = this
|
||||
var type = ev.type
|
||||
|
||||
if (!ev.target) {
|
||||
ev.target = elem
|
||||
}
|
||||
|
||||
if (!elem.listeners) {
|
||||
elem.listeners = {}
|
||||
}
|
||||
|
||||
var listeners = elem.listeners[type]
|
||||
|
||||
if (listeners) {
|
||||
return listeners.forEach(function (listener) {
|
||||
ev.currentTarget = elem
|
||||
if (typeof listener === 'function') {
|
||||
listener(ev)
|
||||
} else {
|
||||
listener.handleEvent(ev)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (elem.parentNode) {
|
||||
elem.parentNode.dispatchEvent(ev)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user