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


TypeScript Observable.forkJoin方法代碼示例

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


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

示例1: getPlayerUnits

  getPlayerUnits(activeAccount: string, playerUnitsLength: number) {
    let indexes: any[] = [];
    for (var i = 0; i < playerUnitsLength; i++) {
      indexes.push(i);
    }

    return Observable.forkJoin(
      indexes.map(index => {
        return this.web3Service.callContract(
          this.contractsService.UserUnitsInstance.userUnits,
          [activeAccount, index, {from: activeAccount}]
        ).then((result) => {
          if (!result || result.error) {
            return result;
          }
          let obj = {
            id: result[0].toNumber(),
            index: index,
            quantity: result[1]
          }
          return obj;
        })
      })
    );
  }
開發者ID:tedchain,項目名稱:crypto-wars-solidity,代碼行數:25,代碼來源:player-units.service.ts

示例2: _

                results => {
                    const files = _(results)
                        .map(result => result.filePath)
                        .compact()
                        .uniq()
                        .map(filePath => readFile$(filePath)
                            .map(content => ({ filePath, content: content.toString().split(/(?:\n|\r\n|\r)/g) })))
                        .value();

                    return Observable.forkJoin(files);
                },
開發者ID:OmniSharp,項目名稱:atom-languageclient,代碼行數:11,代碼來源:DefinitionService.ts

示例3:

 .flatMap((trans:any)=>{
   var tasks$ = [];
   this.transaction = trans.txn;
   this.transaction.status =trans.status.confirmed;
   this.transaction.block_num =trans.status.block_seq;
   trans=trans.txn;
   for(var i=0;i<trans.inputs.length;i++){
     tasks$.push(this.getAddressOfInput(trans.inputs[i]));
   }
   return Observable.forkJoin(...tasks$);
 });
開發者ID:candyYMMA,項目名稱:skycoin,代碼行數:11,代碼來源:transaction-detail.component.ts

示例4: it

	it('should flush all requests on an unshared mock request', rlFakeAsync((): void => {
		let mockedObservable: IMockedRequest<number> = mock.request(result => result);
		Observable.forkJoin<number[]>([
			mockedObservable(5),
			mockedObservable(10),
		]).subscribe(([result1, result2]: number[]): void => {
			expect(result1).to.equal(5);
			expect(result2).to.equal(10);
		});

		mockedObservable.flush();
	}));
開發者ID:arknotts,項目名稱:TypeScript-Angular-Utilities,代碼行數:12,代碼來源:mockAsync.tests.ts

示例5: getAssetsRequirements

 getAssetsRequirements(ids: any[]) {
   return Observable.forkJoin(
     ids.map(id => {
       return this.web3Service.callContract(
         this.contractsService.AssetsRequirementsInstance.getRequirements,
         [id]
       ).then((result) => {
         return result;
       })
     })
   );
 }
開發者ID:tedchain,項目名稱:crypto-wars-solidity,代碼行數:12,代碼來源:assets-requirements.service.ts

示例6: getBuildingsData

 getBuildingsData(ids: any[]) {
   return Observable.forkJoin(
     ids.map(id => {
       return this.web3Service.callContract(
         this.contractsService.BuildingsDataInstance.buildings,
         [id]
       ).then((result) => {
         return result;
       })
     })
   );
 }
開發者ID:tedchain,項目名稱:crypto-wars-solidity,代碼行數:12,代碼來源:buildings-data.service.ts

示例7: getBuildingsIds

  getBuildingsIds(buildingsLength: number) {
    let indexes = [];
    for (var i = 0; i < buildingsLength; i++) {
      indexes.push(i);
    }

    return Observable.forkJoin(
      indexes.map(index => {
        return this.web3Service.callContract(
          this.contractsService.BuildingsDataInstance.buildingIds,
          [index]
        ).then((result) => {
          return result;
        })
      })
    );
  }
開發者ID:tedchain,項目名稱:crypto-wars-solidity,代碼行數:17,代碼來源:buildings-data.service.ts

示例8: it

    it('should re-report all values when subscribed a second time', () => {
        const data = ['a', 'b', 'c'];
        const tracker = new ProjectTracker({
            getPaths() { return data; },
            onDidChangePaths(cb) { return { dispose() { /* */ } }; }
        });

        return Observable.forkJoin(
            tracker.added.take(3).toArray(),
            tracker.added.delay(10).take(3).toArray(),
            tracker.added.delay(5).take(3).toArray(),
        ).toPromise()
            .then(values => {
                expect(values[0]).to.deep.eq(values[1]);
                expect(values[1]).to.deep.eq(values[2]);
                expect(values[2]).to.deep.eq(values[0]);
            });
    });
開發者ID:OmniSharp,項目名稱:atom-languageclient,代碼行數:18,代碼來源:ProjectTrackerSpec.ts


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