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()), ); }) ); }); }
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); }
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())); }); }); }
observeWidgets() { return this.widgetsSubject.startWith( this.getWidgets() ); }