@@ -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) {