From 1621e22ddddcd87bf5907d327212f97409928c25 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Wed, 14 Sep 2011 17:30:39 +0100 Subject: [PATCH] Move onDestroy to the right place --- modules/web.js | 1 - run.js | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/web.js b/modules/web.js index 9a26d79..c4aaf4f 100644 --- a/modules/web.js +++ b/modules/web.js @@ -12,7 +12,6 @@ var webInterface = function(dbot) { app.get('/', function(req, res) { res.render('index', { }); - console.log('test'); }); app.listen(1337); diff --git a/run.js b/run.js index 4a788ec..fe245a4 100644 --- a/run.js +++ b/run.js @@ -30,6 +30,12 @@ DBot.prototype.save = function() { }; DBot.prototype.reloadModules = function() { + this.modules.each(function(module) { + if(module.onDestroy) { + module.onDestroy(); + } + }); + this.rawModules = []; this.modules = []; this.commands = {}; @@ -39,12 +45,6 @@ DBot.prototype.reloadModules = function() { require.cache[path] = undefined; require('./snippets'); - this.modules.each(function(module) { - if(module.onDestroy) { - module.onDestroy(); - } - }); - this.moduleNames.each(function(name) { var cacheKey = require.resolve('./modules/' + name); require.cache[cacheKey] = undefined; // TODO: snippet to remove element properly