From 58ef29e8d520833efd7ae9b5456d7d1117f08706 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Thu, 25 Feb 2016 20:27:01 -0500 Subject: [PATCH] #931 prevent unloaders from being registered more than once --- mithril.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index d023ac34..ce4f1951 100644 --- a/mithril.js +++ b/mithril.js @@ -736,7 +736,7 @@ var unloaders = [] function updateLists(views, controllers, view, controller) { - if (controller.onunload != null) { + if (controller.onunload != null && unloaders.map(function(u) {return u.handler}).indexOf(controller.onunload) < 0) { unloaders.push({ controller: controller, handler: controller.onunload