mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	plugins.js jslint
This commit is contained in:
		| @@ -1,3 +1,5 @@ | |||||||
|  | 'use strict'; | ||||||
|  |  | ||||||
| var fs = require('fs'), | var fs = require('fs'), | ||||||
| 	path = require('path'), | 	path = require('path'), | ||||||
| 	async = require('async'), | 	async = require('async'), | ||||||
| @@ -8,7 +10,7 @@ var fs = require('fs'), | |||||||
|  |  | ||||||
| 	db = require('./database'), | 	db = require('./database'), | ||||||
| 	meta = require('./meta'), | 	meta = require('./meta'), | ||||||
| 	utils = require('./../public/src/utils'), | 	utils = require('../public/src/utils'), | ||||||
| 	pkg = require('../package.json'); | 	pkg = require('../package.json'); | ||||||
|  |  | ||||||
| (function(Plugins) { | (function(Plugins) { | ||||||
| @@ -23,7 +25,7 @@ var fs = require('fs'), | |||||||
| 	Plugins.initialized = false; | 	Plugins.initialized = false; | ||||||
|  |  | ||||||
| 	// Events | 	// Events | ||||||
| 	Plugins.readyEvent = new eventEmitter; | 	Plugins.readyEvent = new eventEmitter(); | ||||||
|  |  | ||||||
| 	Plugins.init = function() { | 	Plugins.init = function() { | ||||||
| 		if (Plugins.initialized) { | 		if (Plugins.initialized) { | ||||||
| @@ -89,7 +91,9 @@ var fs = require('fs'), | |||||||
| 				}); | 				}); | ||||||
| 			}, | 			}, | ||||||
| 			function(next) { | 			function(next) { | ||||||
| 				if (global.env === 'development') winston.info('[plugins] Sorting hooks to fire in priority sequence'); | 				if (global.env === 'development') { | ||||||
|  | 					winston.info('[plugins] Sorting hooks to fire in priority sequence'); | ||||||
|  | 				} | ||||||
| 				Object.keys(Plugins.loadedHooks).forEach(function(hook) { | 				Object.keys(Plugins.loadedHooks).forEach(function(hook) { | ||||||
| 					var hooks = Plugins.loadedHooks[hook]; | 					var hooks = Plugins.loadedHooks[hook]; | ||||||
| 					hooks = hooks.sort(function(a, b) { | 					hooks = hooks.sort(function(a, b) { | ||||||
| @@ -270,7 +274,9 @@ var fs = require('fs'), | |||||||
|  |  | ||||||
| 		if (data.hook && data.method && typeof data.method === 'string' && data.method.length > 0) { | 		if (data.hook && data.method && typeof data.method === 'string' && data.method.length > 0) { | ||||||
| 			data.id = id; | 			data.id = id; | ||||||
| 			if (!data.priority) data.priority = 10; | 			if (!data.priority) { | ||||||
|  | 				data.priority = 10; | ||||||
|  | 			} | ||||||
| 			method = data.method.split('.').reduce(function(memo, prop) { | 			method = data.method.split('.').reduce(function(memo, prop) { | ||||||
| 				if (memo !== null && memo[prop]) { | 				if (memo !== null && memo[prop]) { | ||||||
| 					return memo[prop]; | 					return memo[prop]; | ||||||
| @@ -292,7 +298,7 @@ var fs = require('fs'), | |||||||
| 			Plugins.loadedHooks[data.hook].push(data); | 			Plugins.loadedHooks[data.hook].push(data); | ||||||
|  |  | ||||||
| 			callback(); | 			callback(); | ||||||
| 		} else return; | 		} | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	Plugins.hasListeners = function(hook) { | 	Plugins.hasListeners = function(hook) { | ||||||
| @@ -613,7 +619,9 @@ var fs = require('fs'), | |||||||
| 							}); | 							}); | ||||||
| 						} | 						} | ||||||
| 					], function(err, config) { | 					], function(err, config) { | ||||||
| 						if (err) return next(); // Silently fail | 						if (err) { | ||||||
|  | 							return next(); // Silently fail | ||||||
|  | 						} | ||||||
|  |  | ||||||
| 						plugins.push(config); | 						plugins.push(config); | ||||||
| 						next(); | 						next(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user