2016-05-20 17:06:25 +00:00
|
|
|
"use strict";
|
2016-09-18 21:11:26 +00:00
|
|
|
require("typings-global");
|
2017-02-17 17:56:58 +00:00
|
|
|
const beautycolor = require("beautycolor");
|
|
|
|
const smartq = require("smartq");
|
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) {
|
2017-02-17 17:56:58 +00:00
|
|
|
console.log(`**** starting ${beautycolor.coloredString(moduleNameArg, 'green')} ****`);
|
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 = () => {
|
2017-02-17 17:56:58 +00:00
|
|
|
let done = smartq.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();
|
2017-02-17 17:56:58 +00:00
|
|
|
console.log(`... finished loading within ${beautycolor.coloredString(earlyExecutionTimeString, 'blue')}`);
|
2016-09-18 22:34:38 +00:00
|
|
|
done.resolve(earlyExecutionTime);
|
2016-06-11 21:53:48 +00:00
|
|
|
return done.promise;
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
2017-02-17 17:56:58 +00:00
|
|
|
//# sourceMappingURL=data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