@ngx-loading-bar/core
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -13,9 +13,11 @@ import { Component, Injectable, Input, NgModule } from '@angular/core'; | ||
/** | ||
* @param {?=} initialValue | ||
* @return {?} | ||
*/ | ||
LoadingBarService.prototype.start = function () { | ||
LoadingBarService.prototype.start = function (initialValue) { | ||
if (initialValue === void 0) { initialValue = 2; } | ||
++this._pendingRequests; | ||
if (this._value === 0) { | ||
if (this._value === 0 || this._pendingRequests === 1) { | ||
// Inserts the loading bar element into the dom, and sets it to 2% | ||
this.set(2); | ||
this.set(this._pendingRequests === 1 && this._value > 0 ? this._value : initialValue); | ||
} | ||
@@ -28,21 +30,17 @@ }; | ||
var _this = this; | ||
if (this._pendingRequests === 0) { | ||
if (this._pendingRequests === 0 && this._value === 0) { | ||
return; | ||
} | ||
--this._pendingRequests; | ||
if (this._pendingRequests === 0 && this._value !== 100) { | ||
if (this._value > 0) { | ||
if (this._pendingRequests > 0) { | ||
--this._pendingRequests; | ||
} | ||
if (this._pendingRequests === 0 || (this._pendingRequests === 0 && this._value > 0)) { | ||
if (this._value !== 100) { | ||
this.set(100); | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(function () { return _this.set(0); }, 500); | ||
} | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(function () { return _this.set(0); }, 500); | ||
} | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
LoadingBarService.prototype.ngOnDestroy = function () { | ||
this.progress$.complete(); | ||
}; | ||
/** | ||
* Set the loading bar's width to a certain percent. | ||
@@ -60,2 +58,5 @@ * | ||
this.progress$.next(n); | ||
if (this._pendingRequests === 0) { | ||
return; | ||
} | ||
// increment loadingbar to give the illusion that there is always | ||
@@ -72,6 +73,10 @@ // progress but make sure to cancel the previous timeouts so we don't | ||
* but slows down as it progresses | ||
* @param {?=} rnd | ||
* @return {?} | ||
*/ | ||
LoadingBarService.prototype.increment = function () { | ||
var /** @type {?} */ rnd = 0; | ||
LoadingBarService.prototype.increment = function (rnd) { | ||
if (rnd === void 0) { rnd = 0; } | ||
if (rnd > 0) { | ||
this.set(this._value + rnd); | ||
} | ||
var /** @type {?} */ stat = this._value; | ||
@@ -100,2 +105,8 @@ if (stat >= 0 && stat < 25) { | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
LoadingBarService.prototype.ngOnDestroy = function () { | ||
this.progress$.complete(); | ||
}; | ||
return LoadingBarService; | ||
@@ -102,0 +113,0 @@ }()); |
@@ -14,9 +14,10 @@ import { Component, Injectable, Input, NgModule } from '@angular/core'; | ||
/** | ||
* @param {?=} initialValue | ||
* @return {?} | ||
*/ | ||
start() { | ||
start(initialValue = 2) { | ||
++this._pendingRequests; | ||
if (this._value === 0) { | ||
if (this._value === 0 || this._pendingRequests === 1) { | ||
// Inserts the loading bar element into the dom, and sets it to 2% | ||
this.set(2); | ||
this.set(this._pendingRequests === 1 && this._value > 0 ? this._value : initialValue); | ||
} | ||
@@ -28,21 +29,17 @@ } | ||
complete() { | ||
if (this._pendingRequests === 0) { | ||
if (this._pendingRequests === 0 && this._value === 0) { | ||
return; | ||
} | ||
--this._pendingRequests; | ||
if (this._pendingRequests === 0 && this._value !== 100) { | ||
if (this._value > 0) { | ||
if (this._pendingRequests > 0) { | ||
--this._pendingRequests; | ||
} | ||
if (this._pendingRequests === 0 || (this._pendingRequests === 0 && this._value > 0)) { | ||
if (this._value !== 100) { | ||
this.set(100); | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(() => this.set(0), 500); | ||
} | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(() => this.set(0), 500); | ||
} | ||
} | ||
/** | ||
* @return {?} | ||
*/ | ||
ngOnDestroy() { | ||
this.progress$.complete(); | ||
} | ||
/** | ||
* Set the loading bar's width to a certain percent. | ||
@@ -59,2 +56,5 @@ * | ||
this.progress$.next(n); | ||
if (this._pendingRequests === 0) { | ||
return; | ||
} | ||
// increment loadingbar to give the illusion that there is always | ||
@@ -71,6 +71,9 @@ // progress but make sure to cancel the previous timeouts so we don't | ||
* but slows down as it progresses | ||
* @param {?=} rnd | ||
* @return {?} | ||
*/ | ||
increment() { | ||
let /** @type {?} */ rnd = 0; | ||
increment(rnd = 0) { | ||
if (rnd > 0) { | ||
this.set(this._value + rnd); | ||
} | ||
const /** @type {?} */ stat = this._value; | ||
@@ -99,2 +102,8 @@ if (stat >= 0 && stat < 25) { | ||
} | ||
/** | ||
* @return {?} | ||
*/ | ||
ngOnDestroy() { | ||
this.progress$.complete(); | ||
} | ||
} | ||
@@ -101,0 +110,0 @@ LoadingBarService.decorators = [ |
@@ -15,9 +15,11 @@ (function (global, factory) { | ||
/** | ||
* @param {?=} initialValue | ||
* @return {?} | ||
*/ | ||
LoadingBarService.prototype.start = function () { | ||
LoadingBarService.prototype.start = function (initialValue) { | ||
if (initialValue === void 0) { initialValue = 2; } | ||
++this._pendingRequests; | ||
if (this._value === 0) { | ||
if (this._value === 0 || this._pendingRequests === 1) { | ||
// Inserts the loading bar element into the dom, and sets it to 2% | ||
this.set(2); | ||
this.set(this._pendingRequests === 1 && this._value > 0 ? this._value : initialValue); | ||
} | ||
@@ -30,21 +32,17 @@ }; | ||
var _this = this; | ||
if (this._pendingRequests === 0) { | ||
if (this._pendingRequests === 0 && this._value === 0) { | ||
return; | ||
} | ||
--this._pendingRequests; | ||
if (this._pendingRequests === 0 && this._value !== 100) { | ||
if (this._value > 0) { | ||
if (this._pendingRequests > 0) { | ||
--this._pendingRequests; | ||
} | ||
if (this._pendingRequests === 0 || (this._pendingRequests === 0 && this._value > 0)) { | ||
if (this._value !== 100) { | ||
this.set(100); | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(function () { return _this.set(0); }, 500); | ||
} | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(function () { return _this.set(0); }, 500); | ||
} | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
LoadingBarService.prototype.ngOnDestroy = function () { | ||
this.progress$.complete(); | ||
}; | ||
/** | ||
* Set the loading bar's width to a certain percent. | ||
@@ -62,2 +60,5 @@ * | ||
this.progress$.next(n); | ||
if (this._pendingRequests === 0) { | ||
return; | ||
} | ||
// increment loadingbar to give the illusion that there is always | ||
@@ -74,6 +75,10 @@ // progress but make sure to cancel the previous timeouts so we don't | ||
* but slows down as it progresses | ||
* @param {?=} rnd | ||
* @return {?} | ||
*/ | ||
LoadingBarService.prototype.increment = function () { | ||
var /** @type {?} */ rnd = 0; | ||
LoadingBarService.prototype.increment = function (rnd) { | ||
if (rnd === void 0) { rnd = 0; } | ||
if (rnd > 0) { | ||
this.set(this._value + rnd); | ||
} | ||
var /** @type {?} */ stat = this._value; | ||
@@ -102,2 +107,8 @@ if (stat >= 0 && stat < 25) { | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
LoadingBarService.prototype.ngOnDestroy = function () { | ||
this.progress$.complete(); | ||
}; | ||
return LoadingBarService; | ||
@@ -104,0 +115,0 @@ }()); |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":3,"metadata":{"LoadingBarModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","name":"LoadingBarComponent"}],"exports":[{"__symbolic":"reference","name":"LoadingBarComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"LoadingBarModule"},"providers":[{"__symbolic":"reference","name":"LoadingBarService"}]}}}},"LoadingBarComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"ngx-loading-bar","template":"\n <ng-container *ngIf=\"(loader.progress$|async) as progress\">\n <div id=\"loading-bar-spinner\" *ngIf=\"includeSpinner\" [style.color]=\"color\">\n <div [style.width]=\"diameter\" [style.height]=\"diameter\" class=\"spinner-icon\"></div>\n </div>\n <div id=\"loading-bar\" *ngIf=\"includeBar\" [style.color]=\"color\">\n <div class=\"bar\" [style.background]=\"color\" [style.height]=\"height\" [style.width]=\"progress + '%'\">\n <div class=\"peg\" [style.height]=\"height\"></div>\n </div>\n </div>\n </ng-container>\n ","preserveWhitespaces":false,"styles":["\n /* Make clicks pass-through */\n :host {\n position: relative;\n display: block; }\n :host.loading-bar-fixed > div .bar {\n position: fixed; }\n :host.loading-bar-fixed > div:first-child {\n position: fixed;\n top: 10px;\n left: 10px; }\n :host.loading-bar-fixed > div .peg {\n display: block; }\n :host > div {\n pointer-events: none;\n -webkit-transition: 350ms linear all;\n transition: 350ms linear all;\n color: #29d;\n /* Fancy blur effect */ }\n :host > div .bar {\n -webkit-transition: width 350ms;\n transition: width 350ms;\n background: #29d;\n position: absolute;\n z-index: 10002;\n top: 0;\n left: 0;\n width: 100%;\n height: 2px;\n border-bottom-right-radius: 1px;\n border-top-right-radius: 1px; }\n :host > div .peg {\n display: none;\n position: absolute;\n width: 70px;\n right: 0;\n top: 0;\n height: 2px;\n opacity: .45;\n -webkit-box-shadow: 1px 0 6px 1px;\n box-shadow: 1px 0 6px 1px;\n color: inherit;\n border-radius: 100%; }\n :host > div:first-child {\n display: block;\n position: absolute;\n z-index: 10002;\n top: 5px;\n left: 0px; }\n :host > div:first-child .spinner-icon {\n width: 14px;\n height: 14px;\n border: solid 2px transparent;\n border-top-color: inherit;\n border-left-color: inherit;\n border-radius: 50%;\n -webkit-animation: loading-bar-spinner 400ms linear infinite;\n animation: loading-bar-spinner 400ms linear infinite; }\n\n @-webkit-keyframes loading-bar-spinner {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n @keyframes loading-bar-spinner {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n "],"host":{"[class.loading-bar-fixed]":"fixed"}}]}],"members":{"includeSpinner":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"includeBar":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"fixed":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"color":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"diameter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"LoadingBarService"}]}]}},"LoadingBarService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"start":[{"__symbolic":"method"}],"complete":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"set":[{"__symbolic":"method"}],"increment":[{"__symbolic":"method"}]}}},"origins":{"LoadingBarModule":"./core.module","LoadingBarComponent":"./loading-bar.component","LoadingBarService":"./loading-bar.service"},"importAs":"@ngx-loading-bar/core"} | ||
{"__symbolic":"module","version":3,"metadata":{"LoadingBarModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","name":"LoadingBarComponent"}],"exports":[{"__symbolic":"reference","name":"LoadingBarComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"LoadingBarModule"},"providers":[{"__symbolic":"reference","name":"LoadingBarService"}]}}}},"LoadingBarComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"ngx-loading-bar","template":"\n <ng-container *ngIf=\"(loader.progress$|async) as progress\">\n <div id=\"loading-bar-spinner\" *ngIf=\"includeSpinner\" [style.color]=\"color\">\n <div [style.width]=\"diameter\" [style.height]=\"diameter\" class=\"spinner-icon\"></div>\n </div>\n <div id=\"loading-bar\" *ngIf=\"includeBar\" [style.color]=\"color\">\n <div class=\"bar\" [style.background]=\"color\" [style.height]=\"height\" [style.width]=\"progress + '%'\">\n <div class=\"peg\" [style.height]=\"height\"></div>\n </div>\n </div>\n </ng-container>\n ","preserveWhitespaces":false,"styles":["\n /* Make clicks pass-through */\n :host {\n position: relative;\n display: block; }\n :host.loading-bar-fixed > div .bar {\n position: fixed; }\n :host.loading-bar-fixed > div:first-child {\n position: fixed;\n top: 10px;\n left: 10px; }\n :host.loading-bar-fixed > div .peg {\n display: block; }\n :host > div {\n pointer-events: none;\n -webkit-transition: 350ms linear all;\n transition: 350ms linear all;\n color: #29d;\n /* Fancy blur effect */ }\n :host > div .bar {\n -webkit-transition: width 350ms;\n transition: width 350ms;\n background: #29d;\n position: absolute;\n z-index: 10002;\n top: 0;\n left: 0;\n width: 100%;\n height: 2px;\n border-bottom-right-radius: 1px;\n border-top-right-radius: 1px; }\n :host > div .peg {\n display: none;\n position: absolute;\n width: 70px;\n right: 0;\n top: 0;\n height: 2px;\n opacity: .45;\n -webkit-box-shadow: 1px 0 6px 1px;\n box-shadow: 1px 0 6px 1px;\n color: inherit;\n border-radius: 100%; }\n :host > div:first-child {\n display: block;\n position: absolute;\n z-index: 10002;\n top: 5px;\n left: 0px; }\n :host > div:first-child .spinner-icon {\n width: 14px;\n height: 14px;\n border: solid 2px transparent;\n border-top-color: inherit;\n border-left-color: inherit;\n border-radius: 50%;\n -webkit-animation: loading-bar-spinner 400ms linear infinite;\n animation: loading-bar-spinner 400ms linear infinite; }\n\n @-webkit-keyframes loading-bar-spinner {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n @keyframes loading-bar-spinner {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n "],"host":{"[class.loading-bar-fixed]":"fixed"}}]}],"members":{"includeSpinner":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"includeBar":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"fixed":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"color":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"diameter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"LoadingBarService"}]}]}},"LoadingBarService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"start":[{"__symbolic":"method"}],"complete":[{"__symbolic":"method"}],"set":[{"__symbolic":"method"}],"increment":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}}},"origins":{"LoadingBarModule":"./core.module","LoadingBarComponent":"./loading-bar.component","LoadingBarService":"./loading-bar.service"},"importAs":"@ngx-loading-bar/core"} |
@@ -9,5 +9,4 @@ import { OnDestroy } from '@angular/core'; | ||
private _incTimeout; | ||
start(): void; | ||
start(initialValue?: number): void; | ||
complete(): void; | ||
ngOnDestroy(): void; | ||
/** | ||
@@ -18,3 +17,3 @@ * Set the loading bar's width to a certain percent. | ||
*/ | ||
private set(n); | ||
set(n: any): void; | ||
/** | ||
@@ -24,3 +23,4 @@ * Increments the loading bar by a random amount | ||
*/ | ||
private increment(); | ||
increment(rnd?: number): void; | ||
ngOnDestroy(): void; | ||
} |
{ | ||
"name": "@ngx-loading-bar/core", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Automatic page loading / progress bar for Angular", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76201
681