All finalize functions implemented

This commit is contained in:
Luis Fernando Molina committed 2019-05-06 18:12:42 +02:00
1 parent cf3097d62e
commit 7a571383ec
9 files changed
+115 -216

No files matched your search

+7 -2
View File
@@ -4,13 +4,18 @@ function newEventHandler () {
name: undefined, // This is for debugging purposes only.
listenToEvent: listenToEvent,
stopListening: stopListening,
raiseEvent: raiseEvent
raiseEvent: raiseEvent,
finalize: finalize
}
var eventHandlers = [] // Here we store all the functions we will call when an event is raiseed.
let eventHandlers = [] // Here we store all the functions we will call when an event is raiseed.
return thisObject
function finalize () {
eventHandlers = []
}
function listenToEvent (eventType, handler, extraData) {
let eventSubscriptionId = Math.trunc(Math.random() * 1000000)
eventHandlers.push([eventType, handler, extraData, eventSubscriptionId])