Define the methods on the loading bar provider in angular-loading-bar (#20220)

* Allow @types/angular-loading-bar to export a string name for angular module inclusion

* Add in the methods for @types/angular-loading-bar and fix the tests
This commit is contained in:
Tyrone Dougherty 2017-10-05 00:28:31 +11:00 committed by Masahiro Wakame
parent 86aefa7ce6
commit c29891901e
2 changed files with 36 additions and 10 deletions

View File

@ -13,13 +13,12 @@ class TestController {
app.controller('TestController', TestController);
var barConfig: angular.loadingBar.ILoadingBarProvider[] = [];
barConfig.push({
includeSpinner: true,
includeBar: true,
spinnerTemplate: 'template',
latencyThreshold: 100,
startSize: 0.02,
loadingBarTemplate: '',
autoIncrement: true
});
var barConfig: angular.loadingBar.ILoadingBarProvider;
barConfig.includeSpinner = false;
barConfig.includeBar = false;
barConfig.spinnerTemplate = 'someOtherTemplateString';
barConfig.latencyThreshold = 70;
barConfig.startSize = 0.05;
barConfig.loadingBarTemplate = 'anotherTemplateString';
barConfig.autoIncrement = false;

View File

@ -54,6 +54,33 @@ declare module 'angular' {
* Give illusion that there's always progress
*/
autoIncrement?: boolean;
/**
* Broadcast the start event
*/
start(): void;
/**
* Set the percentage completed
* @param {number} n - number between 0 and 1
*/
set(n: number): void;
/**
* Get the percentage completed
* @returns {number}
*/
status(): number;
/**
* Increment the loading bar
*/
inc(): void;
/**
* Complete the loading bar
*/
complete(): void;
}
}