本文整理匯總了TypeScript中rxjs/observable/forkJoin.forkJoin函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript forkJoin函數的具體用法?TypeScript forkJoin怎麽用?TypeScript forkJoin使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了forkJoin函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getData
getData() {
return forkJoin(
this.getLayers(),
this.getCategories(),
this.getSetting()
);
}
示例2: forkJoin
return editChannel.switchMap(() => {
const thingsToAdd = this.getThingsToAdd(channelFormData, channel);
if (thingsToAdd.length) {
return forkJoin(this.createThingsConnectRequests(channel.id, thingsToAdd));
} else {
return Observable.of([]);
}
}).switchMap(() => {
示例3: forkJoin
this.httpManagerService.post('/json/user/lang', {'uid': this.getUid(), 'lang': key}).subscribe(res => {
forkJoin(
this.translateService.get(res.alert.content),
this.translateService.get('FORM_BUTTON_CLOSE'))
.subscribe(([msg, action]) => {
let snackBarRef = this.snackBar.open(msg, action, {
'duration': 5000
});
});
});
示例4: resolve
resolve(): Observable<Product[]> {
// Get IDs of all products in the shopping cart
const productsInCart = Object.keys(this.shoppingCartService.getItems());
// Create an array of lazy HTTP requests returned by getProductById(). Each request will fetch one product.
const requests = productsInCart.map(productId =>
this.productService.getProductById(productId));
return requests.length ?
forkJoin(requests) : // Spawn parallel requests and emit last value from each
of([]); // Return an empty observable
}
示例5: it
it('it should upload, download, and delete', (done) => {
const data = { angular: "fire" };
const blob = new Blob([JSON.stringify(data)], { type : 'application/json' });
const ref = afStorage.ref('af.json');
const task = ref.put(blob);
// Wait for the upload
const sub = forkJoin(task.snapshotChanges())
// get the url download
.mergeMap(() => ref.getDownloadURL())
// assert the URL
.do(url => expect(url).toBeDefined())
// Delete the file
.mergeMap(url => ref.delete())
// finish the test
.subscribe(done, done.fail);
});
示例6: function
return function(control: AbstractControl) {
const observables = _executeAsyncValidators(control, presentValidators).map(toObservable);
return map.call(forkJoin(observables), _mergeErrors);
};
示例7: updateCategoryTreeAndCategories
updateCategoryTreeAndCategories(id: string, item: any) {
return forkJoin(
this.updateCategoryTree(id, item),
this.getCategories()
);
}