HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/www/zaklada/html/node_modules/rx/ts/core/linq/observable/case.ts
/// <reference path="../../observable.ts" />
/// <reference path="../../concurrency/scheduler.ts" />
module Rx {
    export interface ObservableStatic {
        /**
        *  Uses selector to determine which source in sources to use.
        * @param {Function} selector The function which extracts the value for to test in a case statement.
        * @param {Array} sources A object which has keys which correspond to the case statement labels.
        * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
        *
        * @returns {Observable} An observable sequence which is determined by a case statement.
        */
        case<T>(selector: () => string, sources: { [key: string]: ObservableOrPromise<T>; }, schedulerOrElseSource?: IScheduler | ObservableOrPromise<T>): Observable<T>;
        /**
        *  Uses selector to determine which source in sources to use.
        * @param {Function} selector The function which extracts the value for to test in a case statement.
        * @param {Array} sources A object which has keys which correspond to the case statement labels.
        * @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
        *
        * @returns {Observable} An observable sequence which is determined by a case statement.
        */
        case<T>(selector: () => number, sources: { [key: number]: ObservableOrPromise<T>; }, schedulerOrElseSource?: IScheduler | ObservableOrPromise<T>): Observable<T>;
    }
}

(function() {
    var o: Rx.Observable<string>;
    var p: Rx.Promise<string>;
    var e: Rx.Observable<string>;
    var on: Rx.Observable<number>;
    var pn: Rx.Promise<number>;
    var en: Rx.Observable<number>;

    var so : { [key: string]: Rx.ObservableOrPromise<string>; } = {};
    so['abc'] = p;
    so['def'] = e;
    so['xyz'] = o;

    var no : { [key: number]: Rx.ObservableOrPromise<number>; } = {}
    no[1] = pn;
    no[2] = en;
    no[3] = on;

    o = Rx.Observable.case(() => 'abc', so)
    o = Rx.Observable.case(() => 'abc', so, e)
    o = Rx.Observable.case(() => 'abc', so, Rx.Scheduler.async);

    on = Rx.Observable.case(() => 1, no)
    on = Rx.Observable.case(() => 2, no, en);
    on = Rx.Observable.case(() => 3, no, Rx.Scheduler.async);
});