GithubHelp home page GithubHelp logo

rx.d.ts's People

Contributors

igorbek avatar publicparadise avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

bparadie

rx.d.ts's Issues

Notification<T>.accept should return an Observable<T>

The current typing for Notification<T>.accept in rx-lite.d.ts reads:

accept(observer: IObserver<T>): void;

But the implementation in notification.js always returns an Observable<T>

Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
      return observerOrOnNext && typeof observerOrOnNext === 'object' ?
        this._acceptObservable(observerOrOnNext) :
        this._accept(observerOrOnNext, onError, onCompleted);
    }

rx-lite.d.ts: Incorrect typings for ObserverStatic.fromNotifier

The current typings for ObserverStatic. fromNotifier reads:

fromNotifier<T>(handler: (notification: Notification<T>, thisArg?: any) => void): Observer<T>;

The correct typings are:

fromNotifier<T>(handler: (notification: Notification<T>) => void, thisArg?: any): Observer<T>;

See observer-lite.js:

Observer.fromNotifier = function (handler, thisArg) {

Please change class Scheduler to interface Scheduler and introduce SchedulerStatic

Hello Igor,

please change class Scheduler to interface Scheduler as follows:

    export interface Scheduler extends IScheduler {
        now(): number;
        catch(handler: (exception: any) => boolean): IScheduler;
        catchException(handler: (exception: any) => boolean): IScheduler;

        schedule(action: () => void): IDisposable;
        scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
        scheduleWithAbsolute(dueTime: number, action: () => void): IDisposable;
        scheduleWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
        scheduleWithRelative(dueTime: number, action: () => void): IDisposable;
        scheduleWithRelativeAndState<TState>(state: TState, dueTime: number, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;

        scheduleRecursive(action: (action: () => void) => void): IDisposable;
        scheduleRecursiveWithState<TState>(state: TState, action: (state: TState, action: (state: TState) => void) => void): IDisposable;
        scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
        scheduleRecursiveWithAbsoluteAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;
        scheduleRecursiveWithRelative(dueTime: number, action: (action: (dueTime: number) => void) => void): IDisposable;
        scheduleRecursiveWithRelativeAndState<TState>(state: TState, dueTime: number, action: (state: TState, action: (state: TState, dueTime: number) => void) => void): IDisposable;

        schedulePeriodic(period: number, action: () => void): IDisposable;
        schedulePeriodicWithState<TState>(state: TState, period: number, action: (state: TState) => TState): IDisposable;
    }

    interface SchedulerStatic {
        new (now: () => number,
            schedule: (state: any, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
            scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable,
            scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) => IDisposable) => IDisposable): Scheduler;

        normalize(timeSpan: number): number;

        immediate: IScheduler;
        currentThread: ICurrentThreadScheduler;
        timeout: IScheduler;
    }

    export var Scheduler: SchedulerStatic;

That would be analog to Subject and other classes in rx-lite.d.ts.
By doing so you would allow RxJS-DOM extensions like Scheduler.requestanimationframe to hook into Scheduler's static api:

declare module Rx
{
    export interface SchedulerStatic
    {
        requestAnimationFrame: IScheduler;
    }
}

...

Rx.Scheduler.requestAnimationFrame.schedule( function(): void {
                            ...
                        });

I can also send you a pull request if you grant me push rights.

Thanks!

  • Bernd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.