Merge pull request #4789 from mickdelaney/master

Typings For AngularJS Extensions For RxJS
This commit is contained in:
Masahiro Wakame
2015-07-13 05:39:07 +09:00
2 changed files with 44 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for angularjs extensions to rxjs
// Project: http://reactivex.io/
// Definitions by: Mick Delaney <https://github.com/mickdelaney/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="rx.angular.d.ts" />
var app = angular.module('testModule');
interface AppScope extends rx.angular.IRxScope {
}
app.controller('Ctrl', ($scope: AppScope) => {
this.inputObservable = $scope.$toObservable('term')
.throttle(400)
.safeApply($scope, (results: any) => {
this.results = results;
});
});
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for angularjs extensions to rxjs
// Project: http://reactivex.io/
// Definitions by: Mick Delaney <https://github.com/mickdelaney/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
/// <reference path="../rx/rx.d.ts" />
/// <reference path="../rx/rx.time.d.ts" />
declare module Rx {
interface IObservable<T> {
safeApply($scope: ng.IScope, callback: (data: any) => void): Rx.Observable<any>;
}
}
declare module rx.angular {
export interface IRxScope extends ng.IScope {
$toObservable(property: string): Rx.Observable<any>;
}
}