diff --git a/rx-angular/rx.angular-tests.ts b/rx-angular/rx.angular-tests.ts new file mode 100644 index 000000000..3caf01170 --- /dev/null +++ b/rx-angular/rx.angular-tests.ts @@ -0,0 +1,21 @@ +// Type definitions for angularjs extensions to rxjs +// Project: http://reactivex.io/ +// Definitions by: Mick Delaney +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +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; + }); + +}); diff --git a/rx-angular/rx.angular.d.ts b/rx-angular/rx.angular.d.ts new file mode 100644 index 000000000..e2d0ec8c5 --- /dev/null +++ b/rx-angular/rx.angular.d.ts @@ -0,0 +1,23 @@ +// Type definitions for angularjs extensions to rxjs +// Project: http://reactivex.io/ +// Definitions by: Mick Delaney +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// + +declare module Rx { + + interface IObservable { + safeApply($scope: ng.IScope, callback: (data: any) => void): Rx.Observable; + } +} + +declare module rx.angular { + + export interface IRxScope extends ng.IScope { + $toObservable(property: string): Rx.Observable; + } +} +