Skip to content

Feature/module pattern refactor #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules
reports
tmp
.idea
typings
dist
!.npmignore
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!dist
44 changes: 33 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
sudo: false #use container based infrastructure
sudo: false
language: node_js
node_js:
- "0.12"

- 5.4.1
addons:
apt:
sources:
- libnotify-bin

- libnotify-bin
cache:
directories:
- node_modules
branches:
except:
- "/^v[0-9\\.]+/"
before_install:
- npm install -g pr-bumper
- pr-bumper check
install:
- travis_retry npm install -g gulp
- travis_retry npm install

- travis_retry npm install -g gulp
- travis_retry npm install
- travis_retry typings install
script:
- gulp test

- npm test
- npm run build
after_script:
- gulp coveralls
- gulp coveralls
before_deploy:
- pr-bumper bump
deploy:
provider: npm
email: [email protected]
skip_cleanup: true
on:
branch: master
tags: false
api_key:
secure: cFYp7hSA0BIpBwkv8YdcLPkDkOtUSgAkcpwwiK7vVUjLVPw6vYzwo7EMcTDFZ6CTk9V6OuBFGZQNiHDvv6uZwXcuboItlkIrOelKM+ioer4lYJyausoIv5nkEaJv63vJsFXTZyWALHHbA784zLGqhD46UkQXIcln2OBQAmu564ivYrXF+59FyVKD/no8nb/XMgp6p4650O8XZTK4r4r9rMqfkbDIbpIWTfcbnw1QAhjTO8IcVhX7nfiOeq16zJWM9ndShbizAvRuOd849gkEelM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Jx1v40qBSlIg=
- secure: M7qsXNy9a4dJB9DClvHzLEkTBTW+GXMRDSmrjvmLv44Q/ZJ6QZVZZA4QwwtDs/ZX1RiMvq3YIRbRMWCxbaoUDPp3pt9aTaCWgudUO1icADUt3DmFlEGbAJGotnNI4kRVNHKr1s18Vh30aE+LxPF+7l3WBFBKzDpLddE2p/dGM8QX3E5XKGekkC3ckqEZicKJZqtqee9p8AZ0hrdlOEn7WOG+Xp9WLHPoNVgZvTS4q0RsYBefg4a71vLVOCfF/B6D0drwhW1wkG8jJocZrhfEqAwmhrqN0zm2K5MFHUu7JOYpb+f2Pfm/q9a3BB+dc7Hv0FM/FsRK6UZjRjCwnIO/m1kNU01P0aO03n9T8mzOhUXZV7w1deMPwhmZnzGFTAQ1z0tN+FOgLCjIdc1nx+Zqa5K5a2M/b2oAas6Rqd0N7f25oPxuFr75DXrG4KZyRrrG8UGf/Vb5yLKOitZXoK7vNzfjS307A5OzIHlOzs2QSN5VZHvEyH5L6BD1J/cgCiKhOw4GVpcNT1KhUeMbTdAK+HD37gT1ODNein5+mWnOO4nYCciSC8nR8ZFNUUBHiJULC/kh+w8dh2mwE4s6mTKYfJ+Fn7ExYTqkQfulBBXKDBqZmHzSOc0brHLSOZmpCHP4joj6whG451ewHjdOF8PUiSsxdf8uGtog2XYMjzgxIGc=
3 changes: 0 additions & 3 deletions .yo-rc.json

This file was deleted.

37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Wrapper for https://github.com/victorbjelkholm/ngprogress - automatically handle
[![Build Status](https://travis-ci.org/spira/angular-http-progress.svg?branch=master)](https://travis-ci.org/spira/angular-http-progress)
[![Coverage Status](https://coveralls.io/repos/spira/angular-http-progress/badge.svg?branch=master)](https://coveralls.io/r/spira/angular-http-progress?branch=master)
[![Dependency Status](https://gemnasium.com/spira/angular-http-progress.svg)](https://gemnasium.com/spira/angular-http-progress)
[![Bower version](https://badge.fury.io/bo/angular-http-progress.svg)](http://badge.fury.io/bo/angular-http-progress)
[![npm version](https://badge.fury.io/js/angular-http-progress.svg)](http://badge.fury.io/js/angular-http-progress)

## Intro
Expand All @@ -13,32 +12,40 @@ This module wraps https://github.com/victorbjelkholm/ngprogress, adding an inter

## Installation

Install through bower:
Install with npm:

```sh
bower install angular-http-progress --save
npm install angular-http-progress --save
```

## Usage

* Require the `ngHttpProgress` module in your angular application

```js
angular.module('app', ['ngHttpProgress'])
```ts

import "angular-http-progress";

angular.module('app', ['ngHttpProgress']);

```

* (Optionally) configure the service provider

```js
angular.module('app', ['ngHttpProgress'])
.config(['ngHttpProgress', function(ngHttpProgressProvider){
ngHttpProgressProvider
.configure({
color: '#ff000',
height: '10px'
})
;
}])
```ts

import {NgHttpProgressServiceProvider} from "angular-http-progress";

angular.module('app', ['ngHttpProgress'])
.config(['ngHttpProgress', function(ngHttpProgressProvider:NgHttpProgressServiceProvider){
ngHttpProgressProvider
.configure({
color: '#ff000',
height: '10px'
})
;
}]);

```

* ???
Expand Down
24 changes: 0 additions & 24 deletions bower.json

This file was deleted.

155 changes: 4 additions & 151 deletions dist/ngHttpProgress.d.ts
Original file line number Diff line number Diff line change
@@ -1,151 +1,4 @@
/// <reference path="../typings/tsd.d.ts" />
declare module NgHttpProgress {
class NgHttpProgressInterceptor {
private $q;
private $injector;
private ngHttpProgressService;
/**
* Construct the service with dependencies injected
* @param _$q
* @param _$injector
*/
static $inject: string[];
constructor($q: ng.IQService, $injector: ng.auto.IInjectorService);
private getNgHttpProgressService;
request: (config: any) => any;
response: (response: any) => any;
responseError: (rejection: any) => any;
}
}
declare module NgHttpProgress {
interface ngProgress {
start(): void;
height(cssHeight: string): void;
color(cssColor: string): void;
status(): number;
stop(): void;
set(percentage: number): void;
reset(): void;
complete(): void;
getDomElement(): Element;
}
interface INgHttpProgressService {
start(): ng.IPromise<number>;
stop(): ng.IPromise<number>;
complete(): ng.IPromise<number>;
rewind(): ng.IPromise<number>;
status(): number;
set(percentage: number): void;
}
interface IngHttpProgressServiceProvider {
configure(config: INgHttpProgressServiceConfig): NgHttpProgressServiceProvider;
}
interface INgHttpProgressServiceConfig {
color?: string;
height?: string;
}
}
declare module NgHttpProgress {
class NgHttpProgressService implements INgHttpProgressService {
private config;
private $q;
private $timeout;
private ngProgress;
private currentProgressDeferred;
private progressPromise;
static ngProgressFinishTime: number;
private pendingDelays;
private stopped;
/**
* Construct the service with dependencies injected
* @param config
* @param $q
* @param $timeout
* @param ngProgress
*/
constructor(config: INgHttpProgressServiceConfig, $q: ng.IQService, $timeout: ng.ITimeoutService, ngProgress: ngProgress);
/**
* Start the progress bar running
* @returns {any}
*/
start(): ng.IPromise<number>;
/**
* Bump back the current status to less completed
* @returns {number}
*/
private bumpBack();
/**
* Halt the progress bar
* @returns {IPromise<T>}
*/
stop(): ng.IPromise<number>;
/**
* Complete the progress
* @returns {IPromise<T>}
*/
complete(): ng.IPromise<number>;
/**
* Reset the progress bar to zero
* @returns {IPromise<T>}
*/
rewind(): ng.IPromise<number>;
/**
* Get the status of the progress bar
* @returns {number}
*/
status(): number;
progressStatus(): ng.IPromise<number>;
/**
* Set the status of the progress bar
* @param percentage
*/
set(percentage: number): ng.IPromise<number>;
/**
* Finish the progress of the promise
* @returns {IPromise<any>}
*/
private finish();
/**
* Handle the reset. Immediately invoke as the ngProgress service executes immediately
* @returns {IPromise<number>}
*/
private reset();
/**
* Handle the stopping.
* @returns {IPromise<any>}
*/
private halt();
/**
* Intialise the progress deferred promise
* @returns {IPromise<TResult>}
*/
private initProgressMeter();
}
}
declare module NgHttpProgress {
class Error {
name: string;
message: string;
stack: string;
constructor(message?: string);
}
class NgHttpProgressException extends Error {
message: string;
constructor(message: string);
toString(): string;
}
class NgHttpProgressServiceProvider implements ng.IServiceProvider, IngHttpProgressServiceProvider {
private config;
/**
* Initialise the service provider
*/
constructor();
/**
* Set the configuration
* @param config
* @returns {NgHttpProgress.NgHttpProgressServiceProvider}
*/
configure(config: INgHttpProgressServiceConfig): NgHttpProgressServiceProvider;
$get: (string | (($q: any, $timeout: any, ngProgress: any) => NgHttpProgressService))[];
}
}
import "angular";
export * from "./provider/ngHttpProgressServiceProvider";
export * from "./service/ngHttpProgressService";
export * from "./interceptor/ngHttpProgressInterceptor";
Loading