on master help sign in
Allow disposing the current Elm module from outside.
commit521f94bf4bda308248f15637bca19f52f8bdec08 authorLaszlo Pandy <laszlo.pandy@prezi.com> dateTue 5 Nov 2013, 18:37 (13 years ago) parentc03c27f
1 file changed+11−1
runtime/Init.js+11−1
runtime/Init.js+11−1
@@ -93,6 +93,11 @@ function init(display, container, module, moduleToReplace) {
9393 return newElm;
9494 }
9595
96+ function dispose() {
97+ removeListeners(listeners);
98+ inputs = [];
99+ }
100+
96101 var Module = {};
97102 var reportAnyErrors = function() {};
98103 try {
@@ -117,7 +122,12 @@ function init(display, container, module, moduleToReplace) {
117122 }
118123
119124 reportAnyErrors();
120− return { send:send, recv:recv, swap:swap };
125+ return {
126+ send:send,
127+ recv:recv,
128+ swap:swap,
129+ dispose:dispose
130+ };
121131};
122132
123133function filterListeners(inputs, listeners) {