@ngx-loading-bar/core
Advanced tools
Comparing version 1.0.0-alpha.15 to 1.0.0-alpha.16
@@ -1,2 +0,2 @@ | ||
import { Component, Injectable, Input, NgModule } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, Injectable, Input, NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
@@ -27,3 +27,3 @@ import { Subject as Subject$1 } from 'rxjs/Subject'; | ||
this._pending.next(++this._pendingRequests); | ||
if (this._value === 0 || this._value === 100) { | ||
if (this._value === 0) { | ||
// Inserts the loading bar element into the dom, and sets it to 2% | ||
@@ -46,8 +46,3 @@ this.set(2); | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(function () { | ||
if (_this._value === 100) { | ||
_this.progress$.next(0); | ||
_this._value = 0; | ||
} | ||
}, 500); | ||
setTimeout(function () { return _this.set(0); }, 500); | ||
} | ||
@@ -71,2 +66,5 @@ } | ||
var _this = this; | ||
if (n === 0 && this._pendingRequests > 0) { | ||
n = 2; | ||
} | ||
this._value = n; | ||
@@ -78,3 +76,3 @@ this.progress$.next(n); | ||
clearTimeout(this._incTimeout); | ||
if (this._value < 100) { | ||
if (this._value > 0 && this._value < 100) { | ||
this._incTimeout = setTimeout(function () { return _this.increment(); }, 250); | ||
@@ -129,3 +127,3 @@ } | ||
this.includeSpinner = true; | ||
this.progress$ = this.loader.progress$; | ||
this.includeBar = true; | ||
} | ||
@@ -137,3 +135,4 @@ return LoadingBarComponent; | ||
selector: 'ng-loading-bar, ngx-loading-bar', | ||
template: "\n <ng-container *ngIf=\"(progress$|async) as value\">\n <div id=\"loading-bar-spinner\" *ngIf=\"includeSpinner\"><div class=\"spinner-icon\"></div></div>\n <div id=\"loading-bar\"><div class=\"bar\" [style.width]=\"value + '%'\"><div class=\"peg\"></div></div></div>\n </ng-container>\n ", | ||
template: "\n <ng-container *ngIf=\"(loader.progress$|async) as progress\">\n <div id=\"loading-bar-spinner\" *ngIf=\"includeSpinner\"><div class=\"spinner-icon\"></div></div>\n <div id=\"loading-bar\" *ngIf=\"includeBar\"><div class=\"bar\" [style.width]=\"progress + '%'\"><div class=\"peg\"></div></div></div>\n </ng-container>\n ", | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
},] }, | ||
@@ -149,2 +148,3 @@ ]; | ||
'includeSpinner': [{ type: Input },], | ||
'includeBar': [{ type: Input },], | ||
}; | ||
@@ -151,0 +151,0 @@ var LoadingBarModule = /** @class */ (function () { |
@@ -1,2 +0,2 @@ | ||
import { Component, Injectable, Input, NgModule } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, Injectable, Input, NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
@@ -24,3 +24,3 @@ import { Subject as Subject$1 } from 'rxjs/Subject'; | ||
this._pending.next(++this._pendingRequests); | ||
if (this._value === 0 || this._value === 100) { | ||
if (this._value === 0) { | ||
// Inserts the loading bar element into the dom, and sets it to 2% | ||
@@ -42,8 +42,3 @@ this.set(2); | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(() => { | ||
if (this._value === 100) { | ||
this.progress$.next(0); | ||
this._value = 0; | ||
} | ||
}, 500); | ||
setTimeout(() => this.set(0), 500); | ||
} | ||
@@ -66,2 +61,5 @@ } | ||
set(n) { | ||
if (n === 0 && this._pendingRequests > 0) { | ||
n = 2; | ||
} | ||
this._value = n; | ||
@@ -73,3 +71,3 @@ this.progress$.next(n); | ||
clearTimeout(this._incTimeout); | ||
if (this._value < 100) { | ||
if (this._value > 0 && this._value < 100) { | ||
this._incTimeout = setTimeout(() => this.increment(), 250); | ||
@@ -124,3 +122,3 @@ } | ||
this.includeSpinner = true; | ||
this.progress$ = this.loader.progress$; | ||
this.includeBar = true; | ||
} | ||
@@ -132,7 +130,8 @@ } | ||
template: ` | ||
<ng-container *ngIf="(progress$|async) as value"> | ||
<ng-container *ngIf="(loader.progress$|async) as progress"> | ||
<div id="loading-bar-spinner" *ngIf="includeSpinner"><div class="spinner-icon"></div></div> | ||
<div id="loading-bar"><div class="bar" [style.width]="value + '%'"><div class="peg"></div></div></div> | ||
<div id="loading-bar" *ngIf="includeBar"><div class="bar" [style.width]="progress + '%'"><div class="peg"></div></div></div> | ||
</ng-container> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
},] }, | ||
@@ -148,2 +147,3 @@ ]; | ||
'includeSpinner': [{ type: Input },], | ||
'includeBar': [{ type: Input },], | ||
}; | ||
@@ -150,0 +150,0 @@ |
@@ -30,3 +30,3 @@ (function (global, factory) { | ||
this._pending.next(++this._pendingRequests); | ||
if (this._value === 0 || this._value === 100) { | ||
if (this._value === 0) { | ||
// Inserts the loading bar element into the dom, and sets it to 2% | ||
@@ -49,8 +49,3 @@ this.set(2); | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
setTimeout(function () { | ||
if (_this._value === 100) { | ||
_this.progress$.next(0); | ||
_this._value = 0; | ||
} | ||
}, 500); | ||
setTimeout(function () { return _this.set(0); }, 500); | ||
} | ||
@@ -74,2 +69,5 @@ } | ||
var _this = this; | ||
if (n === 0 && this._pendingRequests > 0) { | ||
n = 2; | ||
} | ||
this._value = n; | ||
@@ -81,3 +79,3 @@ this.progress$.next(n); | ||
clearTimeout(this._incTimeout); | ||
if (this._value < 100) { | ||
if (this._value > 0 && this._value < 100) { | ||
this._incTimeout = setTimeout(function () { return _this.increment(); }, 250); | ||
@@ -132,3 +130,3 @@ } | ||
this.includeSpinner = true; | ||
this.progress$ = this.loader.progress$; | ||
this.includeBar = true; | ||
} | ||
@@ -140,3 +138,4 @@ return LoadingBarComponent; | ||
selector: 'ng-loading-bar, ngx-loading-bar', | ||
template: "\n <ng-container *ngIf=\"(progress$|async) as value\">\n <div id=\"loading-bar-spinner\" *ngIf=\"includeSpinner\"><div class=\"spinner-icon\"></div></div>\n <div id=\"loading-bar\"><div class=\"bar\" [style.width]=\"value + '%'\"><div class=\"peg\"></div></div></div>\n </ng-container>\n ", | ||
template: "\n <ng-container *ngIf=\"(loader.progress$|async) as progress\">\n <div id=\"loading-bar-spinner\" *ngIf=\"includeSpinner\"><div class=\"spinner-icon\"></div></div>\n <div id=\"loading-bar\" *ngIf=\"includeBar\"><div class=\"bar\" [style.width]=\"progress + '%'\"><div class=\"peg\"></div></div></div>\n </ng-container>\n ", | ||
changeDetection: core.ChangeDetectionStrategy.OnPush, | ||
},] }, | ||
@@ -152,2 +151,3 @@ ]; | ||
'includeSpinner': [{ type: core.Input },], | ||
'includeBar': [{ type: core.Input },], | ||
}; | ||
@@ -154,0 +154,0 @@ var LoadingBarModule = /** @class */ (function () { |
@@ -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":"ng-loading-bar, ngx-loading-bar","template":"\n <ng-container *ngIf=\"(progress$|async) as value\">\n <div id=\"loading-bar-spinner\" *ngIf=\"includeSpinner\"><div class=\"spinner-icon\"></div></div>\n <div id=\"loading-bar\"><div class=\"bar\" [style.width]=\"value + '%'\"><div class=\"peg\"></div></div></div>\n </ng-container>\n "}]}],"members":{"includeSpinner":[{"__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":"ng-loading-bar, ngx-loading-bar","template":"\n <ng-container *ngIf=\"(loader.progress$|async) as progress\">\n <div id=\"loading-bar-spinner\" *ngIf=\"includeSpinner\"><div class=\"spinner-icon\"></div></div>\n <div id=\"loading-bar\" *ngIf=\"includeBar\"><div class=\"bar\" [style.width]=\"progress + '%'\"><div class=\"peg\"></div></div></div>\n </ng-container>\n ","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy"},"member":"OnPush"}}]}],"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"}}]}],"__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"} |
import { LoadingBarService } from './loading-bar.service'; | ||
import { Subject } from 'rxjs/Subject'; | ||
export declare class LoadingBarComponent { | ||
private loader; | ||
loader: LoadingBarService; | ||
includeSpinner: boolean; | ||
progress$: Subject<number>; | ||
includeBar: boolean; | ||
constructor(loader: LoadingBarService); | ||
} |
@@ -14,6 +14,6 @@ import { OnDestroy } from '@angular/core'; | ||
/** | ||
* Set the loading bar's width to a certain percent. | ||
* | ||
* @param n any value between 0 and 100 | ||
*/ | ||
* Set the loading bar's width to a certain percent. | ||
* | ||
* @param n any value between 0 and 100 | ||
*/ | ||
private set(n); | ||
@@ -20,0 +20,0 @@ /** |
{ | ||
"name": "@ngx-loading-bar/core", | ||
"version": "1.0.0-alpha.15", | ||
"version": "1.0.0-alpha.16", | ||
"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
55340
641