forked from GitHub/dbot
		
	module on destroy and process exit
This commit is contained in:
		
							parent
							
								
									a63d350b50
								
							
						
					
					
						commit
						36874ac3e6
					
				| @ -16,7 +16,12 @@ var webInterface = function(dbot) { | ||||
|     }); | ||||
| 
 | ||||
|     app.listen(1337); | ||||
|     return { }; | ||||
| 
 | ||||
|     return {  | ||||
|         'onDestroy': function() { | ||||
|             process.exit(); | ||||
|         } | ||||
|     }; | ||||
| }; | ||||
| 
 | ||||
| exports.fetch = function(dbot) { | ||||
|  | ||||
							
								
								
									
										7
									
								
								run.js
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								run.js
									
									
									
									
									
								
							| @ -17,6 +17,7 @@ var DBot = function(dModules, timers) { | ||||
|         this.instance.join('#fail'); | ||||
|         this.instance.join('#42'); | ||||
|         this.instance.join('#itonlygetsworse'); | ||||
|         this.instance.join('#plur'); | ||||
|     }.bind(this)); | ||||
| 
 | ||||
|     this.moduleNames = dModules; | ||||
| @ -42,6 +43,12 @@ 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
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Luke Slater
						Luke Slater