From 7e82393d9f1ceaa05b111f704de8ae908fbc9cc0 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 21 Jul 2014 13:14:12 -0400 Subject: [PATCH] plugins:loaded - using emitter class instead --- src/plugins.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/plugins.js b/src/plugins.js index fa1e8429ce..a70d762734 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -5,10 +5,10 @@ var fs = require('fs'), async = require('async'), winston = require('winston'), nconf = require('nconf'), - eventEmitter = require('events').EventEmitter, semver = require('semver'), db = require('./database'), + emitter = require('./emitter'), meta = require('./meta'), utils = require('../public/src/utils'), pkg = require('../package.json'); @@ -24,9 +24,6 @@ var fs = require('fs'), Plugins.initialized = false; - // Events - Plugins.readyEvent = new eventEmitter(); - Plugins.init = function() { if (Plugins.initialized) { return; @@ -47,14 +44,15 @@ var fs = require('fs'), if (global.env === 'development') { winston.info('[plugins] Plugins OK'); } + Plugins.initialized = true; - Plugins.readyEvent.emit('ready'); + emitter.emit('plugins:loaded'); }); }; Plugins.ready = function(callback) { if (!Plugins.initialized) { - Plugins.readyEvent.once('ready', callback); + emitter.once('plugins:loaded', callback); } else { callback(); }