2016-05-20 17:06:25 +00:00
|
|
|
"use strict";
|
2016-09-18 21:11:26 +00:00
|
|
|
require("typings-global");
|
|
|
|
const chalk = require("chalk");
|
|
|
|
const q = require("q");
|
2016-08-20 05:03:49 +00:00
|
|
|
let doText = false;
|
2016-09-15 12:45:58 +00:00
|
|
|
let moduleName = 'undefined module name';
|
2016-09-18 22:34:38 +00:00
|
|
|
let startTime = Date.now();
|
|
|
|
if (process.argv.indexOf('-v') === -1) {
|
2016-06-10 03:36:06 +00:00
|
|
|
doText = true;
|
|
|
|
}
|
2016-09-18 22:34:38 +00:00
|
|
|
/**
|
|
|
|
* start the loading
|
|
|
|
*/
|
2016-09-15 12:45:58 +00:00
|
|
|
exports.start = function (moduleNameArg = '', loaderLengthArg = '10') {
|
2016-08-20 05:03:49 +00:00
|
|
|
moduleName = moduleNameArg;
|
2016-09-18 22:34:38 +00:00
|
|
|
if (doText) {
|
2016-08-20 05:03:49 +00:00
|
|
|
console.log(`**** starting ${chalk.green(moduleNameArg)} ****`);
|
2016-06-10 03:36:06 +00:00
|
|
|
}
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
2016-09-15 12:45:58 +00:00
|
|
|
exports.stop = () => {
|
2016-08-20 05:03:49 +00:00
|
|
|
let done = q.defer();
|
2016-08-20 06:42:39 +00:00
|
|
|
let endTime = Date.now();
|
2016-09-15 12:59:22 +00:00
|
|
|
let earlyExecutionTime = (endTime - startTime);
|
|
|
|
let earlyExecutionTimeString = (earlyExecutionTime / 1000).toString();
|
2016-09-18 22:34:38 +00:00
|
|
|
console.log(`... finished loading ${moduleName} in ${earlyExecutionTimeString}`);
|
|
|
|
done.resolve(earlyExecutionTime);
|
2016-06-11 21:53:48 +00:00
|
|
|
return done.promise;
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
2016-09-18 22:34:38 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoi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