Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![npm version](https://badge.fury.io/js/ngx-ui-loader.svg)](https://badge.fury.io/js/ngx-ui-loader)
[![npm](https://img.shields.io/npm/v/ngx-ui-loader)](https://www.npmjs.com/package/ngx-ui-loader)
[![GitHub stars](https://img.shields.io/github/stars/t-ho/ngx-ui-loader?color=00bcd4)](https://github.com/t-ho/ngx-ui-loader/stargazers)
[![demo](https://img.shields.io/badge/demo-StackBlitz-blueviolet.svg)](https://stackblitz.com/edit/ngx-ui-loader)
[![Build Status](https://travis-ci.org/t-ho/ngx-ui-loader.svg?branch=master)](https://travis-ci.org/t-ho/ngx-ui-loader)
[![codecov](https://codecov.io/gh/t-ho/ngx-ui-loader/branch/master/graph/badge.svg)](https://codecov.io/gh/t-ho/ngx-ui-loader)
Expand Down
124 changes: 58 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
"private": true,
"dependencies": {
"@angular/animations": "~9.0.4",
"@angular/cdk": "~9.1.0",
"@angular/cdk": "^9.1.3",
"@angular/common": "~9.0.4",
"@angular/compiler": "~9.0.4",
"@angular/core": "~9.0.4",
"@angular/flex-layout": "^9.0.0-beta.29",
"@angular/forms": "~9.0.4",
"@angular/material": "^9.1.0",
"@angular/material": "^9.1.3",
"@angular/platform-browser": "~9.0.4",
"@angular/platform-browser-dynamic": "~9.0.4",
"@angular/router": "~9.0.4",
"@schuchard/prettier": "^3.1.0",
"ngx-color-picker": "^9.0.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.4",
Expand All @@ -39,7 +39,7 @@
"@angular/language-service": "~9.0.4",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"@types/node": "^12.12.30",
"codelyzer": "^5.1.2",
"husky": "^4.2.3",
"jasmine-core": "~3.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const FOREGROUND = true;
const IS_BOUND = true;
const IS_MASTER = true;
const LOADER_ID_01 = 'loader-id-01';
const MIN_TIME = 300;
const MIN_TIME = 0;
const MAX_TIME = 8000;
const NOT_EXISTING_LOADER_ID = 'not-existing-loader-id';
const NOT_EXISTING_TASK_ID = 'not-existing-task-id';
Expand Down Expand Up @@ -927,7 +927,7 @@ describe(`NgxUiLoaderService (loaderId == ${DEFAULT_MASTER_LOADER_ID})`, () => {
}).not.toThrowError(`[ngx-ui-loader] - taskId "${DUPLICATED_TASK_ID}" is duplicated.`);
});

it(`#check duplicate task id - 2 - should not throw any error`, () => {
it(`#check duplicate task id - 2 - should throw an error`, () => {
loaderService.startBackgroundLoader(DEFAULT_MASTER_LOADER_ID, DUPLICATED_TASK_ID);
expect(() => {
loaderService.startLoader(DEFAULT_MASTER_LOADER_ID, DUPLICATED_TASK_ID);
Expand All @@ -941,7 +941,7 @@ describe(`NgxUiLoaderService (loaderId == ${DEFAULT_MASTER_LOADER_ID})`, () => {
}).not.toThrowError(`[ngx-ui-loader] - taskId "${DUPLICATED_TASK_ID}" is duplicated.`);
});

it(`#check duplicate task id - 4 - should not throw any error`, () => {
it(`#check duplicate task id - 4 - should throw an error`, () => {
loaderService.startBackground(DUPLICATED_TASK_ID);
expect(() => {
loaderService.start(DUPLICATED_TASK_ID);
Expand Down
16 changes: 4 additions & 12 deletions projects/ngx-ui-loader/src/lib/core/ngx-ui-loader.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,9 @@ export class NgxUiLoaderService {
* @docs-private
*/
private clearTimers(task: Task): void {
if (task.delayTimer) {
clearTimeout(task.delayTimer);
}
if (task.maxTimer) {
clearTimeout(task.maxTimer);
}
if (task.minTimer) {
clearTimeout(task.minTimer);
}
clearTimeout(task.delayTimer);
clearTimeout(task.maxTimer);
clearTimeout(task.minTimer);
}

/**
Expand Down Expand Up @@ -465,9 +459,7 @@ export class NgxUiLoaderService {
private setMaxTimer(task: Task, loaderId: string): void {
if (task.maxTime > task.minTime) {
// restart the task, reset maxTimer
if (task.maxTimer) {
clearTimeout(task.maxTimer);
}
clearTimeout(task.maxTimer);
task.maxTimer = setTimeout(() => {
if (task.isForeground) {
this.stopLoader(loaderId, task.taskId);
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-ui-loader/src/lib/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const DEFAULT_TIME: Time = {};

export const MIN_DELAY = 0;

export const MIN_TIME = 300;
export const MIN_TIME = 0;

export const CLOSING_TIME = 1001;

Expand Down Expand Up @@ -169,5 +169,5 @@ export const DEFAULT_CONFIG: NgxUiLoaderConfig = {
textColor: '#FFFFFF',
textPosition: POSITION.centerCenter,
maxTime: -1,
minTime: 500
minTime: 300
};
Loading