本文整理匯總了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
});
}
示例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);
}
示例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);
}
示例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(
示例5:
/**
* @author happygrammer
*/
import * as Rx from '@reactivex/rxjs';
Rx.Observable.of('a', 'b', 'c').subscribe((v) => console.log(v));
示例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));
示例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);
}
示例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)
})
示例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));
示例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));