當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Observable.of方法代碼示例

本文整理匯總了TypeScript中@reactivex/rxjs.Observable.of方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Observable.of方法的具體用法?TypeScript Observable.of怎麽用?TypeScript Observable.of使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@reactivex/rxjs.Observable的用法示例。


在下文中一共展示了Observable.of方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 (data) => {
     return Rx.Observable.of({
         target: target,
         data: data,
         fileName: file.name
     });
 }
開發者ID:czcorpus,項目名稱:kontext,代碼行數:7,代碼來源:form.ts

示例2: newValidationStatus

 (resp) => {
     const ans = newValidationStatus();
     ans.currPasswd = resp.fields.curr_passwd;
     ans.newPasswd = resp.fields.new_passwd;
     ans.newPasswd2 = resp.fields.new_passwd2;
     ans.messages = resp.messages.splice(0);
     return Rx.Observable.of(ans);
 }
開發者ID:czcorpus,項目名稱:kontext,代碼行數:8,代碼來源:profile.ts

示例3: Error

 (data) => {
     console.log('data: ', data);
     if (data.lastpage && data.Items.length === 0) {
         throw new Error(this.layoutModel.translate('wordlist__page_not_found_err'));
     }
     this.data = this.importData(data.Items);
     this.isLastPage = !!data.lastpage;
     return Rx.Observable.of(data);
 }
開發者ID:czcorpus,項目名稱:kontext,代碼行數:9,代碼來源:main.ts

示例4: return

        return (() => {
            if (this.numItems === null) {
                return this.layoutModel.ajax$<WlSizeAjaxResponse>(
                    'GET',
                    this.layoutModel.createActionUrl('wordlist/ajax_get_wordlist_size'),
                    args

                );

            } else {
                return Rx.Observable.of({
                        messages: [],
                        size: this.numItems
                });
            }
        })().concatMap(
開發者ID:czcorpus,項目名稱:kontext,代碼行數:16,代碼來源:main.ts

示例5:

/**
 * @author happygrammer
 */
import * as Rx from '@reactivex/rxjs';
Rx.Observable.of('a', 'b', 'c').subscribe((v) => console.log(v));
開發者ID:chun4foryou,項目名稱:develop,代碼行數:5,代碼來源:hello_rxjs.ts

示例6:

/**
 * @author happygrammer
 */
import * as Rx from "@reactivex/rxjs";

const one = Rx.Observable.of(1, 2, 3);
const two = Rx.Observable.of("a", "b", "c");
const sum = one.concat(two);
const subscribe = sum.subscribe(val => console.log(val));
開發者ID:chun4foryou,項目名稱:develop,代碼行數:9,代碼來源:concat.ts

示例7: String

 (data) => {
     this.numItems = data.size;
     this.currPage = ~~Math.ceil(this.numItems / this.pageSize);
     this.currPageInput = String(this.currPage);
     return Rx.Observable.of(true);
 }
開發者ID:czcorpus,項目名稱:kontext,代碼行數:6,代碼來源:main.ts

示例8:

import { Observable } from '@reactivex/rxjs'

/*
A ------> |
B ------> | -> E
C -> D -> |
*/

const A$ = Observable.interval(1000)
const B$ = Observable.of(3)
const C$ = Observable.from([5, 6, 7])
const D$ = C$.toArray().map(arr => arr.reduce((acc, val) => acc + val, 0))
const E$ = Observable.combineLatest(A$, B$, D$).map(arr => arr.reduce((acc, val) => acc + val, 0))

E$.subscribe(observer => {
    console.log(observer)
})
開發者ID:taochunyu,項目名稱:learn,代碼行數:17,代碼來源:combe.ts

示例9:

/**
 * @author happygrammer
 */
import * as Rx from "@reactivex/rxjs";

Rx.Observable.of(1, 2, 3).subscribe(val => console.log(val));
Rx.Observable.of("a", "b", "c").subscribe(val => console.log(val));
Rx.Observable.of(["a", "b"], ["c", "d"]).subscribe(val => console.log(val));

開發者ID:chun4foryou,項目名稱:develop,代碼行數:8,代碼來源:of.ts

示例10:

/**
 * @author happygrammer
 */
import * as Rx from "@reactivex/rxjs";

const source = Rx.Observable.of(1, 10, 20, 30, 40);
const $every = source.every(val => val % 2 === 0);
$every.subscribe(val => console.log(val));
開發者ID:chun4foryou,項目名稱:develop,代碼行數:8,代碼來源:every.ts


注:本文中的@reactivex/rxjs.Observable.of方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。