now working with CI
This commit is contained in:
parent
5908dc8b6f
commit
3f1a05d3e0
4
.npmignore
Normal file
4
.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
docs/
|
||||
coverage/
|
||||
ts/typings/
|
||||
.travis.yml
|
15
README.md
15
README.md
@ -1,12 +1,15 @@
|
||||
# early
|
||||
nice module loading animation for modules that need a little starting time.
|
||||
minimal and fast loading animation for modules that need a little starting time.
|
||||
|
||||
> **note: this package is NOT READY YET**
|
||||
## Usage
|
||||
|
||||
```typscript
|
||||
```typescript
|
||||
// Put the following at the start of your module
|
||||
import * as early from "early";
|
||||
early.start();
|
||||
// do your loading stuff
|
||||
early.stop();
|
||||
early.start("myModuleName");
|
||||
/*
|
||||
do your loading stuff
|
||||
*/
|
||||
early.stop(); // stop "early" when your module is ready
|
||||
```
|
||||
|
||||
|
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare let start: (moduleNameArg: string, loaderLengthArg?: number) => void;
|
||||
export declare let start: (moduleNameArg?: string, loaderLengthArg?: number) => void;
|
||||
export declare let stop: () => void;
|
||||
|
17
dist/index.js
vendored
17
dist/index.js
vendored
@ -2,10 +2,13 @@
|
||||
/// <reference path="./typings/index.d.ts" />
|
||||
var colors = require("colors");
|
||||
var readline = require("readline");
|
||||
var rl = readline.createInterface({
|
||||
var rl;
|
||||
var initReadline = function () {
|
||||
rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
};
|
||||
var moduleName;
|
||||
var loaderLength;
|
||||
var frameCounter = 0;
|
||||
@ -36,16 +39,26 @@ var logEarly = function () {
|
||||
};
|
||||
// exports
|
||||
exports.start = function (moduleNameArg, loaderLengthArg) {
|
||||
if (moduleNameArg === void 0) { moduleNameArg = ""; }
|
||||
if (loaderLengthArg === void 0) { loaderLengthArg = 10; }
|
||||
abort = false;
|
||||
moduleName = moduleNameArg;
|
||||
loaderLength = loaderLengthArg;
|
||||
if (!process.env.CI) {
|
||||
initReadline();
|
||||
logEarly();
|
||||
}
|
||||
else {
|
||||
console.log("**** starting " + moduleName + " ****");
|
||||
}
|
||||
;
|
||||
};
|
||||
exports.stop = function () {
|
||||
abort = true;
|
||||
if (!process.env.CI) {
|
||||
rl.write(null, { ctrl: true, name: 'u' });
|
||||
rl.close();
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw2Q0FBNkM7QUFDN0MsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQy9CLElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUVuQyxJQUFNLEVBQUUsR0FBRyxRQUFRLENBQUMsZUFBZSxDQUFDO0lBQ2xDLEtBQUssRUFBRSxPQUFPLENBQUMsS0FBSztJQUNwQixNQUFNLEVBQUUsT0FBTyxDQUFDLE1BQU07Q0FDdkIsQ0FBQyxDQUFDO0FBRUgsSUFBSSxVQUFpQixDQUFDO0FBQ3RCLElBQUksWUFBbUIsQ0FBQztBQUN4QixJQUFJLFlBQVksR0FBVSxDQUFDLENBQUM7QUFFNUIsSUFBSSxTQUFTLEdBQUc7SUFDWixJQUFJLFlBQVksR0FBVSxHQUFHO1VBQ3ZCLEdBQUcsQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLFlBQVksQ0FBQztVQUM5QixHQUFHLENBQUMsTUFBTSxDQUFDLFlBQVksR0FBRyxZQUFZLENBQUM7VUFDdkMsR0FBRztVQUNILFlBQVk7VUFDWixVQUFVLENBQUMsSUFBSSxDQUFDO0lBRXRCLEVBQUUsQ0FBQSxDQUFDLFlBQVksSUFBSSxZQUFZLENBQUMsQ0FBQSxDQUFDO1FBQzdCLFlBQVksR0FBRyxDQUFDLENBQUM7SUF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,10 +2,13 @@
|
||||
let colors = require("colors");
|
||||
let readline = require("readline");
|
||||
|
||||
const rl = readline.createInterface({
|
||||
let rl;
|
||||
let initReadline = () => {
|
||||
rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
};
|
||||
|
||||
let moduleName:string;
|
||||
let loaderLength:number;
|
||||
@ -40,16 +43,23 @@ let logEarly = () => {
|
||||
|
||||
|
||||
// exports
|
||||
export let start = function(moduleNameArg:string,loaderLengthArg:number = 10){
|
||||
export let start = function(moduleNameArg:string = "",loaderLengthArg:number = 10){
|
||||
abort = false;
|
||||
moduleName = moduleNameArg;
|
||||
loaderLength = loaderLengthArg;
|
||||
if (!process.env.CI){
|
||||
initReadline();
|
||||
logEarly();
|
||||
} else {
|
||||
console.log("**** starting " + moduleName + " ****");
|
||||
};
|
||||
};
|
||||
|
||||
export let stop = function(){
|
||||
abort = true;
|
||||
if (!process.env.CI){
|
||||
rl.write(null, {ctrl: true, name: 'u'});
|
||||
rl.close();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user