From f4b502ceac7827e68b0f19742d13fc5332f2687e Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 21 Oct 2014 14:49:03 +0900 Subject: [PATCH] add angular-http-auth definitions --- CONTRIBUTORS.md | 3 ++- angular-http-auth/angular-http-auth-tests.ts | 14 ++++++++++++++ angular-http-auth/angular-http-auth.d.ts | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 angular-http-auth/angular-http-auth-tests.ts create mode 100644 angular-http-auth/angular-http-auth.d.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a227bb830cb92e..84f0c9190fe313 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -17,6 +17,7 @@ All definitions files include a header with the author and editors, so at some p * [angular-spinner](https://github.com/urish/angular-spinner) (by [Marcin BiegaƂa](https://github.com/Biegal)) * [AngularUI](http://angular-ui.github.io/) (by [Michel Salib](https://github.com/michelsalib)) * [Angular Hotkeys](https://github.com/chieffancypants/angular-hotkeys/) (by [Jason Zhao](https://github.com/jlz27)) +* [angular-http-auth](https://github.com/witoldsz/angular-http-auth) (by [vvakame](https://github.com/vvakame)) * [Angular Protractor](https://github.com/angular/protractor) (by [Bill Armstrong](https://github.com/BillArmstrong)) * [Angular Translate](http://pascalprecht.github.io/angular-translate/) (by [Michel Salib](https://github.com/michelsalib)) * [Angular UI Bootstrap](http://angular-ui.github.io/bootstrap) (by [Brian Surowiec](https://github.com/xt0rted)) @@ -317,7 +318,7 @@ All definitions files include a header with the author and editors, so at some p * [PDF.js](https://github.com/mozilla/pdf.js) (by [Josh Baldwin](https://github.com/jbaldwin)) * [PeerJS](http://peerjs.com/) (by [Toshiya Nakakura](https://github.com/nakakura)) * [PEG.js](http://pegjs.majda.cz/) (by [vvakame](https://github.com/vvakame)) -* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto)) +* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto)) * [PgwModal](http://pgwjs.com/pgwmodal/) (by [Pine Mizune](https://github.com/pine613)) * [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker)) * [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov)) diff --git a/angular-http-auth/angular-http-auth-tests.ts b/angular-http-auth/angular-http-auth-tests.ts new file mode 100644 index 00000000000000..4d246d1907c9be --- /dev/null +++ b/angular-http-auth/angular-http-auth-tests.ts @@ -0,0 +1,14 @@ +/// + +(function () { + 'use strict'; + angular.module('login', ['http-auth-interceptor']) + + .controller('LoginController', ($scope:any, $http:any, authService:ng.httpAuth.IAuthService) => { + $scope.submit = () => { + $http.post('auth/login').success(() => { + authService.loginConfirmed(); + }); + } + }); +})(); diff --git a/angular-http-auth/angular-http-auth.d.ts b/angular-http-auth/angular-http-auth.d.ts new file mode 100644 index 00000000000000..297761c4781609 --- /dev/null +++ b/angular-http-auth/angular-http-auth.d.ts @@ -0,0 +1,19 @@ +// Type definitions for angular-http-auth 1.2.1 +// Project: https://github.com/witoldsz/angular-http-auth +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ng.httpAuth { + interface IAuthService { + loginConfirmed(data?:any, configUpdater?:Function):void; + loginCancelled(data?:any, reason?:any):void; + } + + interface IHttpBuffer { + append(config:ng.IRequestConfig, deferred:{resolve(data:any):void; reject(data:any):void;}):void; + rejectAll(reason?:any):void; + retryAll(updater?:Function):void; + } +}