ng-loading-bar
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,359 +0,290 @@ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(require("@angular/core"), require("@angular/http"), require("rxjs/Subject"), require("rxjs/add/operator/share")); | ||
else if(typeof define === 'function' && define.amd) | ||
define(["@angular/core", "@angular/http", "rxjs/Subject", "rxjs/add/operator/share"], factory); | ||
else if(typeof exports === 'object') | ||
exports["ng-loading-bar"] = factory(require("@angular/core"), require("@angular/http"), require("rxjs/Subject"), require("rxjs/add/operator/share")); | ||
else | ||
root["ng-loading-bar"] = factory(root["@angular/core"], root["@angular/http"], root["rxjs/Subject"], root["rxjs/add/operator/share"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_6__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ exports: {}, | ||
/******/ id: moduleId, | ||
/******/ loaded: false | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/http'), require('rxjs/Subject'), require('rxjs/add/operator/share')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/http', 'rxjs/Subject', 'rxjs/add/operator/share'], factory) : | ||
(factory((global['ng-loading-bar'] = {}),global.ng.core,global.ng.http,global.Rx)); | ||
}(this, (function (exports,_angular_core,_angular_http,rxjs_Subject) { 'use strict'; | ||
"use strict"; | ||
var loading_bar_module_1 = __webpack_require__(1); | ||
exports.NgLoadingBarModule = loading_bar_module_1.NgLoadingBarModule; | ||
var loading_bar_http_1 = __webpack_require__(4); | ||
exports.NgLoadingBarHttp = loading_bar_http_1.NgLoadingBarHttp; | ||
var loading_bar_component_1 = __webpack_require__(7); | ||
exports.NgLoadingBarComponent = loading_bar_component_1.NgLoadingBarComponent; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var NgLoadingBarHttp = (function (_super) { | ||
__extends(NgLoadingBarHttp, _super); | ||
function NgLoadingBarHttp() { | ||
var _this = _super.apply(this, arguments) || this; | ||
_this.pending = new rxjs_Subject.Subject(); | ||
_this._pendingRequests = 0; | ||
return _this; | ||
} | ||
/** | ||
* @param {?} url | ||
* @param {?=} options | ||
* @return {?} | ||
*/ | ||
NgLoadingBarHttp.prototype.request = function (url, options) { | ||
var _this = this; | ||
var /** @type {?} */ response = _super.prototype.request.call(this, url, options).share(); | ||
if (options && options.ignoreLoadingBar === true) { | ||
return response; | ||
} | ||
this.requestStarted(); | ||
response.subscribe(function (x) { }, function (err) { return _this.requestEnded(); }, function () { return _this.requestEnded(); }); | ||
return response; | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
NgLoadingBarHttp.prototype.requestStarted = function () { | ||
this.pending.next({ | ||
started: this._pendingRequests === 0, | ||
pendingRequests: ++this._pendingRequests, | ||
}); | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
NgLoadingBarHttp.prototype.requestEnded = function () { | ||
this.pending.next({ | ||
completed: this._pendingRequests === 1, | ||
pendingRequests: --this._pendingRequests, | ||
}); | ||
}; | ||
return NgLoadingBarHttp; | ||
}(_angular_http.Http)); | ||
NgLoadingBarHttp.decorators = [ | ||
{ type: _angular_core.Injectable }, | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
NgLoadingBarHttp.ctorParameters = function () { return []; }; | ||
var NgLoadingBarComponent = (function () { | ||
/** | ||
* @param {?} _renderer | ||
* @param {?} http | ||
*/ | ||
function NgLoadingBarComponent(_renderer, http) { | ||
var _this = this; | ||
this._renderer = _renderer; | ||
this.includeSpinner = true; | ||
this._autoIncrement = true; | ||
this._includeBar = true; | ||
this._latencyThreshold = 10; | ||
this._startSize = 0.02; | ||
this._started = false; | ||
this._status = 0; | ||
if (http instanceof NgLoadingBarHttp) { | ||
http.pending.subscribe(function (progress) { | ||
if (progress.started) | ||
_this.start(); | ||
if (progress.completed) | ||
_this.complete(); | ||
}); | ||
} | ||
} | ||
/** | ||
* @return {?} | ||
*/ | ||
NgLoadingBarComponent.prototype.ngAfterViewInit = function () { | ||
this.hide(this._loadingBarContainer); | ||
this.hide(this._spinner); | ||
}; | ||
/** | ||
* Inserts the loading bar element into the dom, and sets it to 2% | ||
* @return {?} | ||
*/ | ||
NgLoadingBarComponent.prototype.start = function () { | ||
var _this = this; | ||
this._startTimeout = setTimeout(function () { | ||
clearTimeout(_this._completeTimeout); | ||
// do not continually broadcast the started event: | ||
if (_this._started) { | ||
return; | ||
} | ||
_this._started = true; | ||
_this._status = 0; | ||
if (_this._includeBar) { | ||
_this.show(_this._loadingBarContainer); | ||
} | ||
if (_this.includeSpinner) { | ||
_this.show(_this._spinner); | ||
} | ||
_this.set(_this._startSize); | ||
}, this._latencyThreshold); | ||
}; | ||
/** | ||
* Set the loading bar's width to a certain percent. | ||
* | ||
* @param {?} n any value between 0 and 1 | ||
* @return {?} | ||
*/ | ||
NgLoadingBarComponent.prototype.set = function (n) { | ||
var _this = this; | ||
if (!this._started) { | ||
return; | ||
} | ||
var /** @type {?} */ pct = (n * 100) + '%'; | ||
this.setElementStyle(this._loadingBar, 'width', pct); | ||
this._status = n; | ||
// increment loadingbar to give the illusion that there is always | ||
// progress but make sure to cancel the previous timeouts so we don't | ||
// have multiple incs running at the same time. | ||
if (this._autoIncrement) { | ||
clearTimeout(this._incTimeout); | ||
this._incTimeout = setTimeout(function () { | ||
_this.inc(); | ||
}, 250); | ||
} | ||
}; | ||
/** | ||
* @return {?} | ||
*/ | ||
NgLoadingBarComponent.prototype.complete = function () { | ||
var _this = this; | ||
setTimeout(function () { | ||
_this.set(1); | ||
clearTimeout(_this._completeTimeout); | ||
clearTimeout(_this._startTimeout); | ||
// Attempt to aggregate any start/complete calls within 500ms: | ||
_this._completeTimeout = setTimeout(function () { | ||
_this._started = false; | ||
_this.hide(_this._loadingBarContainer); | ||
_this.hide(_this._spinner); | ||
}, 500); | ||
}, this._latencyThreshold); | ||
}; | ||
/** | ||
* Increments the loading bar by a random amount | ||
* but slows down as it progresses | ||
* @return {?} | ||
*/ | ||
NgLoadingBarComponent.prototype.inc = function () { | ||
if (this._status >= 1) { | ||
return; | ||
} | ||
var /** @type {?} */ rnd = 0; | ||
var /** @type {?} */ stat = this._status; | ||
if (stat >= 0 && stat < 0.25) { | ||
// Start out between 3 - 6% increments | ||
rnd = (Math.random() * (5 - 3 + 1) + 3) / 100; | ||
} | ||
else if (stat >= 0.25 && stat < 0.65) { | ||
// increment between 0 - 3% | ||
rnd = (Math.random() * 3) / 100; | ||
} | ||
else if (stat >= 0.65 && stat < 0.9) { | ||
// increment between 0 - 2% | ||
rnd = (Math.random() * 2) / 100; | ||
} | ||
else if (stat >= 0.9 && stat < 0.99) { | ||
// finally, increment it .5 % | ||
rnd = 0.005; | ||
} | ||
else { | ||
// after 99%, don't increment: | ||
rnd = 0; | ||
} | ||
var /** @type {?} */ pct = this._status + rnd; | ||
this.set(pct); | ||
}; | ||
/** | ||
* @param {?} el | ||
* @return {?} | ||
*/ | ||
NgLoadingBarComponent.prototype.show = function (el) { | ||
this.setElementStyle(el, 'display', 'block'); | ||
}; | ||
/** | ||
* @param {?} el | ||
* @return {?} | ||
*/ | ||
NgLoadingBarComponent.prototype.hide = function (el) { | ||
this.setElementStyle(el, 'display', 'none'); | ||
}; | ||
/** | ||
* @param {?} el | ||
* @param {?} styleName | ||
* @param {?} styleValue | ||
* @return {?} | ||
*/ | ||
NgLoadingBarComponent.prototype.setElementStyle = function (el, styleName, styleValue) { | ||
this._renderer.setElementStyle(el.nativeElement, styleName, styleValue); | ||
}; | ||
return NgLoadingBarComponent; | ||
}()); | ||
NgLoadingBarComponent.decorators = [ | ||
{ type: _angular_core.Component, args: [{ | ||
selector: 'ng-loading-bar', | ||
template: "\n <div id=\"loading-bar-spinner\" #loadingBarSpinner><div class=\"spinner-icon\"></div></div>\n <div id=\"loading-bar\" #loadingBarContainer><div class=\"bar\" #loadingBar><div class=\"peg\"></div></div></div>\n ", | ||
},] }, | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
NgLoadingBarComponent.ctorParameters = function () { return [ | ||
{ type: _angular_core.Renderer, }, | ||
{ type: NgLoadingBarHttp, decorators: [{ type: _angular_core.Inject, args: [_angular_http.Http,] },] }, | ||
]; }; | ||
NgLoadingBarComponent.propDecorators = { | ||
'_spinner': [{ type: _angular_core.ViewChild, args: ['loadingBarSpinner',] },], | ||
'_loadingBarContainer': [{ type: _angular_core.ViewChild, args: ['loadingBarContainer',] },], | ||
'_loadingBar': [{ type: _angular_core.ViewChild, args: ['loadingBar',] },], | ||
'includeSpinner': [{ type: _angular_core.Input },], | ||
}; | ||
/** | ||
* @param {?} xhrBackend | ||
* @param {?} requestOptions | ||
* @return {?} | ||
*/ | ||
function httpFactory(xhrBackend, requestOptions) { | ||
return new NgLoadingBarHttp(xhrBackend, requestOptions); | ||
} | ||
var NgLoadingBarModule = (function () { | ||
function NgLoadingBarModule() { | ||
} | ||
/** | ||
* @return {?} | ||
*/ | ||
NgLoadingBarModule.forRoot = function () { | ||
return { | ||
ngModule: NgLoadingBarModule, | ||
providers: [ | ||
{ provide: _angular_http.Http, useFactory: httpFactory, deps: [_angular_http.XHRBackend, _angular_http.RequestOptions] }, | ||
], | ||
}; | ||
}; | ||
return NgLoadingBarModule; | ||
}()); | ||
NgLoadingBarModule.decorators = [ | ||
{ type: _angular_core.NgModule, args: [{ | ||
declarations: [ | ||
NgLoadingBarComponent, | ||
], | ||
imports: [ | ||
_angular_http.HttpModule, | ||
], | ||
exports: [ | ||
NgLoadingBarComponent, | ||
], | ||
},] }, | ||
]; | ||
/** | ||
* @nocollapse | ||
*/ | ||
NgLoadingBarModule.ctorParameters = function () { return []; }; | ||
exports.NgLoadingBarModule = NgLoadingBarModule; | ||
exports.NgLoadingBarHttp = NgLoadingBarHttp; | ||
exports.NgLoadingBarComponent = NgLoadingBarComponent; | ||
exports.ɵa = httpFactory; | ||
/***/ }, | ||
/* 1 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var core_1 = __webpack_require__(2); | ||
var http_1 = __webpack_require__(3); | ||
var loading_bar_http_1 = __webpack_require__(4); | ||
var loading_bar_component_1 = __webpack_require__(7); | ||
function httpFactory(xhrBackend, requestOptions) { | ||
return new loading_bar_http_1.NgLoadingBarHttp(xhrBackend, requestOptions); | ||
} | ||
exports.httpFactory = httpFactory; | ||
var NgLoadingBarModule = (function () { | ||
function NgLoadingBarModule() { | ||
} | ||
NgLoadingBarModule.forRoot = function () { | ||
return { | ||
ngModule: NgLoadingBarModule, | ||
providers: [ | ||
{ provide: http_1.Http, useFactory: httpFactory, deps: [http_1.XHRBackend, http_1.RequestOptions] }, | ||
], | ||
}; | ||
}; | ||
NgLoadingBarModule = __decorate([ | ||
core_1.NgModule({ | ||
declarations: [ | ||
loading_bar_component_1.NgLoadingBarComponent, | ||
], | ||
imports: [ | ||
http_1.HttpModule, | ||
], | ||
exports: [ | ||
loading_bar_component_1.NgLoadingBarComponent, | ||
], | ||
}), | ||
__metadata('design:paramtypes', []) | ||
], NgLoadingBarModule); | ||
return NgLoadingBarModule; | ||
}()); | ||
exports.NgLoadingBarModule = NgLoadingBarModule; | ||
/***/ }, | ||
/* 2 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_2__; | ||
/***/ }, | ||
/* 3 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_3__; | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var http_1 = __webpack_require__(3); | ||
var core_1 = __webpack_require__(2); | ||
var Subject_1 = __webpack_require__(5); | ||
__webpack_require__(6); | ||
var NgLoadingBarHttp = (function (_super) { | ||
__extends(NgLoadingBarHttp, _super); | ||
function NgLoadingBarHttp() { | ||
_super.apply(this, arguments); | ||
this.pending = new Subject_1.Subject(); | ||
this._pendingRequests = 0; | ||
} | ||
NgLoadingBarHttp.prototype.request = function (url, options) { | ||
var _this = this; | ||
var response = _super.prototype.request.call(this, url, options).share(); | ||
if (options && options.ignoreLoadingBar === true) { | ||
return response; | ||
} | ||
this.requestStarted(); | ||
response.subscribe(function (x) { }, function (err) { return _this.requestEnded(); }, function () { return _this.requestEnded(); }); | ||
return response; | ||
}; | ||
NgLoadingBarHttp.prototype.requestStarted = function () { | ||
this.pending.next({ | ||
started: this._pendingRequests === 0, | ||
pendingRequests: ++this._pendingRequests, | ||
}); | ||
}; | ||
NgLoadingBarHttp.prototype.requestEnded = function () { | ||
this.pending.next({ | ||
completed: this._pendingRequests === 1, | ||
pendingRequests: --this._pendingRequests, | ||
}); | ||
}; | ||
NgLoadingBarHttp = __decorate([ | ||
core_1.Injectable(), | ||
__metadata('design:paramtypes', []) | ||
], NgLoadingBarHttp); | ||
return NgLoadingBarHttp; | ||
}(http_1.Http)); | ||
exports.NgLoadingBarHttp = NgLoadingBarHttp; | ||
/***/ }, | ||
/* 5 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_5__; | ||
/***/ }, | ||
/* 6 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_6__; | ||
/***/ }, | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var __param = (this && this.__param) || function (paramIndex, decorator) { | ||
return function (target, key) { decorator(target, key, paramIndex); } | ||
}; | ||
var core_1 = __webpack_require__(2); | ||
var http_1 = __webpack_require__(3); | ||
var loading_bar_http_1 = __webpack_require__(4); | ||
var NgLoadingBarComponent = (function () { | ||
function NgLoadingBarComponent(_renderer, http) { | ||
var _this = this; | ||
this._renderer = _renderer; | ||
this.includeSpinner = true; | ||
this._autoIncrement = true; | ||
this._includeBar = true; | ||
this._latencyThreshold = 10; | ||
this._startSize = 0.02; | ||
this._started = false; | ||
this._status = 0; | ||
if (http instanceof loading_bar_http_1.NgLoadingBarHttp) { | ||
http.pending.subscribe(function (progress) { | ||
if (progress.started) | ||
_this.start(); | ||
if (progress.completed) | ||
_this.complete(); | ||
}); | ||
} | ||
} | ||
NgLoadingBarComponent.prototype.ngAfterViewInit = function () { | ||
this.hide(this._loadingBarContainer); | ||
this.hide(this._spinner); | ||
}; | ||
NgLoadingBarComponent.prototype.start = function () { | ||
var _this = this; | ||
this._startTimeout = setTimeout(function () { | ||
clearTimeout(_this._completeTimeout); | ||
if (_this._started) { | ||
return; | ||
} | ||
_this._started = true; | ||
_this._status = 0; | ||
if (_this._includeBar) { | ||
_this.show(_this._loadingBarContainer); | ||
} | ||
if (_this.includeSpinner) { | ||
_this.show(_this._spinner); | ||
} | ||
_this.set(_this._startSize); | ||
}, this._latencyThreshold); | ||
}; | ||
NgLoadingBarComponent.prototype.set = function (n) { | ||
var _this = this; | ||
if (!this._started) { | ||
return; | ||
} | ||
var pct = (n * 100) + '%'; | ||
this.setElementStyle(this._loadingBar, 'width', pct); | ||
this._status = n; | ||
if (this._autoIncrement) { | ||
clearTimeout(this._incTimeout); | ||
this._incTimeout = setTimeout(function () { | ||
_this.inc(); | ||
}, 250); | ||
} | ||
}; | ||
NgLoadingBarComponent.prototype.complete = function () { | ||
var _this = this; | ||
setTimeout(function () { | ||
_this.set(1); | ||
clearTimeout(_this._completeTimeout); | ||
clearTimeout(_this._startTimeout); | ||
_this._completeTimeout = setTimeout(function () { | ||
_this._started = false; | ||
_this.hide(_this._loadingBarContainer); | ||
_this.hide(_this._spinner); | ||
}, 500); | ||
}, this._latencyThreshold); | ||
}; | ||
NgLoadingBarComponent.prototype.inc = function () { | ||
if (this._status >= 1) { | ||
return; | ||
} | ||
var rnd = 0; | ||
var stat = this._status; | ||
if (stat >= 0 && stat < 0.25) { | ||
rnd = (Math.random() * (5 - 3 + 1) + 3) / 100; | ||
} | ||
else if (stat >= 0.25 && stat < 0.65) { | ||
rnd = (Math.random() * 3) / 100; | ||
} | ||
else if (stat >= 0.65 && stat < 0.9) { | ||
rnd = (Math.random() * 2) / 100; | ||
} | ||
else if (stat >= 0.9 && stat < 0.99) { | ||
rnd = 0.005; | ||
} | ||
else { | ||
rnd = 0; | ||
} | ||
var pct = this._status + rnd; | ||
this.set(pct); | ||
}; | ||
NgLoadingBarComponent.prototype.show = function (el) { | ||
this.setElementStyle(el, 'display', 'block'); | ||
}; | ||
NgLoadingBarComponent.prototype.hide = function (el) { | ||
this.setElementStyle(el, 'display', 'none'); | ||
}; | ||
NgLoadingBarComponent.prototype.setElementStyle = function (el, styleName, styleValue) { | ||
this._renderer.setElementStyle(el.nativeElement, styleName, styleValue); | ||
}; | ||
__decorate([ | ||
core_1.ViewChild('loadingBarSpinner'), | ||
__metadata('design:type', Object) | ||
], NgLoadingBarComponent.prototype, "_spinner", void 0); | ||
__decorate([ | ||
core_1.ViewChild('loadingBarContainer'), | ||
__metadata('design:type', Object) | ||
], NgLoadingBarComponent.prototype, "_loadingBarContainer", void 0); | ||
__decorate([ | ||
core_1.ViewChild('loadingBar'), | ||
__metadata('design:type', Object) | ||
], NgLoadingBarComponent.prototype, "_loadingBar", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Boolean) | ||
], NgLoadingBarComponent.prototype, "includeSpinner", void 0); | ||
NgLoadingBarComponent = __decorate([ | ||
core_1.Component({ | ||
selector: 'ng-loading-bar', | ||
template: "\n <div id=\"loading-bar-spinner\" #loadingBarSpinner><div class=\"spinner-icon\"></div></div>\n <div id=\"loading-bar\" #loadingBarContainer><div class=\"bar\" #loadingBar><div class=\"peg\"></div></div></div>\n ", | ||
}), | ||
__param(1, core_1.Inject(http_1.Http)), | ||
__metadata('design:paramtypes', [core_1.Renderer, loading_bar_http_1.NgLoadingBarHttp]) | ||
], NgLoadingBarComponent); | ||
return NgLoadingBarComponent; | ||
}()); | ||
exports.NgLoadingBarComponent = NgLoadingBarComponent; | ||
/***/ } | ||
/******/ ]) | ||
}); | ||
; | ||
//# sourceMappingURL=ng-loading-bar.umd.js.map | ||
}))); | ||
//# sourceMappingURL=ng-loading-bar.umd.js.map |
{ | ||
"name": "ng-loading-bar", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"main": "bundles/ng-loading-bar.umd.js", | ||
"module": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"module": "ng-loading-bar/ng-loading-bar.es5.js", | ||
"typings": "ng-loading-bar.d.ts", | ||
"repository": { | ||
@@ -12,67 +12,19 @@ "url": "https://github.com/aitboudad/ng-loading-bar.git", | ||
"peerDependencies": { | ||
"@angular/core": "^2.0.0 || ^4.0.0", | ||
"@angular/http": "^2.0.0 || ^4.0.0" | ||
"@angular/core": "^4.0.0", | ||
"@angular/http": "^4.0.0" | ||
}, | ||
"scripts": { | ||
"ngc": "./node_modules/.bin/ngc", | ||
"lint": "./node_modules/.bin/tslint 'src/**/*.ts' 'demo/**/*.ts' --noUnusedParameters", | ||
"prepublish": "npm run build", | ||
"build": "npm run build:lib && npm run build:bundles", | ||
"prebuild:lib": "shx rm -rf ./lib", | ||
"build:lib": "npm run ngc -- --project tsconfig.build.json", | ||
"prebuild:bundles": "shx rm -rf ./bundles", | ||
"build:bundles": "npm run build:bundles:compile && npm run build:bundles:minify", | ||
"build:bundles:compile": "./node_modules/.bin/webpack --config .config/webpack.build.js", | ||
"build:bundles:minify": "uglifyjs bundles/ng-loading-bar.umd.js --output bundles/ng-loading-bar.umd.min.js --in-source-map bundles/ng-loading-bar.umd.js.map --source-map bundles/ng-loading-bar.umd.min.js.map", | ||
"demo": "node_modules/.bin/webpack-dashboard --title ng-loading-bar-demo -- node_modules/.bin/webpack-dev-server --quiet --port 9000 --content-base demo --config .config/webpack.demo.js --open", | ||
"test": "./node_modules/.bin/karma start", | ||
"test-watch": "./node_modules/.bin/karma start --no-single-run --auto-watch" | ||
}, | ||
"devDependencies": { | ||
"@angular/common": "^2.3.1", | ||
"@angular/compiler": "^2.3.1", | ||
"@angular/compiler-cli": "^2.3.1", | ||
"@angular/core": "^2.3.1", | ||
"@angular/forms": "^2.3.1", | ||
"@angular/http": "^2.3.1", | ||
"@angular/platform-browser": "^2.3.1", | ||
"@angular/platform-browser-dynamic": "^2.3.1", | ||
"@types/jasmine": "^2.5.38", | ||
"@types/node": "^6.0.51", | ||
"angular-in-memory-web-api": "^0.2.1", | ||
"angular2-template-loader": "^0.6.0", | ||
"awesome-typescript-loader": "^3.0.0-beta.5", | ||
"codecov": "^1.0.1", | ||
"codelyzer": "2.0.0-beta.3", | ||
"commitizen": "^2.8.6", | ||
"core-js": "^2.4.1", | ||
"cz-conventional-changelog": "^1.2.0", | ||
"istanbul-instrumenter-loader": "^0.2.0", | ||
"jasmine": "^2.5.2", | ||
"karma": "^1.3.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-jasmine": "^1.0.2", | ||
"karma-mocha-reporter": "^2.2.1", | ||
"karma-phantomjs-launcher": "^1.0.2", | ||
"karma-remap-coverage": "^0.1.2", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "1.8.0", | ||
"phantomjs-prebuilt": "^2.1.13", | ||
"raw-loader": "^0.5.1", | ||
"remap-istanbul": "^0.7.0", | ||
"rxjs": "^5.0.0-rc.4", | ||
"shx": "^0.2.1", | ||
"tslint": "^4.0.2", | ||
"typescript": "2.0.10", | ||
"uglify-js": "^2.7.5", | ||
"webpack": "^1.13.3", | ||
"webpack-dashboard": "^0.2.0", | ||
"webpack-dev-server": "^1.16.2", | ||
"zone.js": "^0.7.2" | ||
}, | ||
"author": "Abdellatif Ait boudad", | ||
"description": "Automatic page loading / progress bar for Angular 2", | ||
"keywords": ["angular", "angular2", "ng", "ng2", "loading", "loadingbar", "progress", "progressbar"], | ||
"license": "MIT" | ||
} | ||
"keywords": [ | ||
"angular", | ||
"angular2", | ||
"ng", | ||
"ng2", | ||
"loading", | ||
"loadingbar", | ||
"progress", | ||
"progressbar" | ||
], | ||
"license": "MIT", | ||
"es2015": "ng-loading-bar/ng-loading-bar.js" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
2
90109
19
1045
1