early/ts/index.ts

37 lines
909 B
TypeScript
Raw Normal View History

2016-06-10 03:18:03 +00:00
import "typings-global"
2016-05-23 02:51:45 +00:00
import colors = require("colors");
import path = require("path");
2016-06-10 03:18:03 +00:00
import readline = require("readline");
import childProcess = require("child_process");
let earlyChild;
2016-06-10 03:18:03 +00:00
let doAnimation:boolean = true;
if(process.argv.indexOf("-v") != -1){
doAnimation = false;
}
2016-05-21 18:33:13 +00:00
// exports
export let start = function(moduleNameArg:string = "",loaderLengthArg:string = "10"){
2016-06-10 03:18:03 +00:00
if(doAnimation){
earlyChild = childProcess.fork(path.join(__dirname,"early.child.js"),[],{
env: {
moduleNameArg:moduleNameArg,
loaderLengthArg:loaderLengthArg,
CI: process.env.CI
}
});
}
2016-05-20 17:06:25 +00:00
};
export let stop = function(){
2016-06-10 03:18:03 +00:00
if(doAnimation){
earlyChild.kill();
let rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.close();
}
2016-05-20 17:06:25 +00:00
};