Created
February 21, 2016 09:51
-
-
Save pmoelgaard/d17af9281cd0e8958fa2 to your computer and use it in GitHub Desktop.
Hook Harvester - Early Version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path='../../typings/tsd.d.ts' /> | |
import path = require('path'); | |
import async = require('async'); | |
function ModuleDef(server:any, next:Function):void { | |
var glob:any = require("glob"); | |
glob('local_modules/**/hooks/**/*.js', function (err:Error, hooks:Array<string>):void { | |
async.eachSeries( | |
hooks, | |
function (hook:string, hookCallback:Function):void { | |
var hookPath = path.join(__dirname, '../../', hook); | |
var hook:Function = require(hookPath); | |
hook(server, function (err:Error, hook:any):void { | |
console.log(hook); | |
hookCallback(err, hook); | |
}); | |
}, | |
function (err:Error):void { | |
next(); | |
} | |
) | |
}) | |
} | |
export = ModuleDef; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment