コード例 #1
0
 getPlatformGroups(
   buckRoot: string,
   ruleType: string,
   buildTarget: string,
 ): Observable<Array<PlatformGroup>> {
   return this._providersChanged.startWith(undefined).switchMap(() => {
     const observables = this._registeredProviders.map(provider =>
       provider(buckRoot, ruleType, buildTarget).catch(error => {
         getLogger('nuclide-buck').error(
           `Getting buck platform groups from ${provider.name} failed:`,
           error,
         );
         return Observable.of(null);
       }),
     );
     return (
       Observable.from(observables)
         // $FlowFixMe: type combineAll
         .combineAll()
         .map(platformGroups => {
           return platformGroups
             .filter(p => p != null)
             .sort((a, b) =>
               a.name.toUpperCase().localeCompare(b.name.toUpperCase()),
             );
         })
     );
   });
 }
コード例 #2
0
ファイル: Base.js プロジェクト: szagi3891/reacttest
        constructor(props: PropsTypeIn) {
            super(props);

            type PropsSubscribeType = {
                props: PropsTypeOut,
                mounted: bool
            };

            const newProps$: Observable<PropsTypeOut> = mapProps(this.receive$.asObservable())
                .distinctUntilChanged(isEqualProps);

            const mounted$: Observable<bool> = this.mounted$.startWith(false);

            this.subscription = newProps$
                .withLatestFrom(mounted$, (props: PropsTypeOut, mounted: bool): PropsSubscribeType => ({
                      props,
                      mounted
                }))
                .subscribe((propsSubscribe: PropsSubscribeType) => {
                    this.innerProps = propsSubscribe.props;

                    if (propsSubscribe.mounted) {
                        this.forceUpdate();
                    }
                });

            this.receive$.next(this.props);
        }
コード例 #3
0
ファイル: PlatformService.js プロジェクト: rlugojr/nuclide
 getPlatformGroups(
   buckRoot: string,
   ruleType: string,
   buildTarget: string,
 ): Observable<Array<PlatformGroup>> {
   return this._providersChanged
     .startWith(undefined)
     .switchMap(() => {
       const observables = this._registeredProviders
         .map(provider => provider(buckRoot, ruleType, buildTarget));
       return Observable.from(observables)
         // $FlowFixMe: type combineAll
         .combineAll()
         .map(platformGroups => {
           return platformGroups
             .filter(p => p != null)
             .sort((a, b) => a.name.toUpperCase().localeCompare(b.name.toUpperCase()));
         });
     });
 }
コード例 #4
0
ファイル: createApp.js プロジェクト: heidilaw4/frint
 observeWidgets() {
   return this.widgetsSubject.startWith(
     this.getWidgets()
   );
 }