Stop Listening to Events Implemented
This commit is contained in:
1 parent
9fef60c27e
commit
d22ee32d6a
2 files changed
+38
-1
No files matched your search
@@ -7,6 +7,7 @@ function newEventHandler() {
|
||||
name: undefined, // This is for debugging purposes only.
|
||||
parentEventHandler: undefined, // Here we store the parent cointainer zoom object.
|
||||
listenToEvent: listenToEvent,
|
||||
stopListening: stopListening,
|
||||
raiseEvent: raiseEvent,
|
||||
initialize: initialize
|
||||
};
|
||||
@@ -32,6 +33,35 @@ function newEventHandler() {
|
||||
|
||||
}
|
||||
|
||||
function stopListening(pEventType, pHandler) {
|
||||
|
||||
if (thisObject.name !== undefined && CONSOLE_LOG === true) {
|
||||
|
||||
console.log("Event Handler named " + thisObject.name + " received a request to stop listening to an the event " + pEventType + " with this handler: " + pHandler);
|
||||
|
||||
}
|
||||
|
||||
for (let i = 0; i < eventHandlers.length; i++) {
|
||||
|
||||
let record = eventHandlers[i];
|
||||
let eventType = record[0];
|
||||
let handler = record[1];
|
||||
|
||||
if (pEventType === eventType && pHandler.toString() === handler.toString()) {
|
||||
|
||||
eventHandlers.splice(i, 1);
|
||||
|
||||
if (thisObject.name !== undefined && CONSOLE_LOG === true) {
|
||||
|
||||
console.log("Evethandler found and deleted.");
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function raiseEvent(eventType, event) {
|
||||
|
||||
if (thisObject.name !== undefined && CONSOLE_LOG === true) {
|
||||
|
||||
+8
-1
@@ -1,7 +1,7 @@
|
||||
function newTimelineChart() {
|
||||
|
||||
const MODULE_NAME = "Timeline Chart";
|
||||
const INFO_LOG = false;
|
||||
const INFO_LOG = true;
|
||||
const INTENSIVE_LOG = false;
|
||||
const ERROR_LOG = true;
|
||||
const logger = newWebDebugLog();
|
||||
@@ -717,8 +717,15 @@
|
||||
|
||||
productPlotters[i].storage.finalize();
|
||||
|
||||
if (productPlotters[i].plotter.finalize !== undefined) {
|
||||
|
||||
productPlotters[i].plotter.finalize();
|
||||
|
||||
}
|
||||
|
||||
productPlotters.splice(i, 1); // Delete item from array.
|
||||
|
||||
return; // We already found the product woth changes and processed it.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user