当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript redux-package.ReduxPackageCombiner类代码示例

本文整理汇总了TypeScript中redux-package.ReduxPackageCombiner的典型用法代码示例。如果您正苦于以下问题:TypeScript ReduxPackageCombiner类的具体用法?TypeScript ReduxPackageCombiner怎么用?TypeScript ReduxPackageCombiner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ReduxPackageCombiner类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: watchForAutoLogin

  watchForAutoLogin(): Observable<ILoginActionPayload> {
    const isAuto = (loginState: ILoginState): boolean => {
      if (loginState)
        return loginState.userId === null;
      return false;
    };

    let lastLoginState = null;
    ReduxPackageCombiner
      .select(LOGIN_PACKAGE_NAME)
      .subscribe((loginState: ILoginState) => {
        lastLoginState = loginState;
      });

    let subject = new Subject();

    this.firebase.auth().onAuthStateChanged((fbuser) => {
      console.log('Log in dectected  - autologin checker');
      const user = transformUser(fbuser);
      console.log(user);
      if (user) {
        checkUserProfile(this.firebase.database(), user);
        subject.next(LoginActions.loginSuccessFactory(
          user,
          user._id,
          isAuto(lastLoginState)
        ));
      }
    });
    return subject;
  }
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:31,代码来源:login-service-firebase.ts

示例2: beforeEach

    beforeEach(() => {
      let featureToggleModule: FeatureTogglePackage = new FeatureTogglePackage();
      ReduxPackageCombiner.reset();
      ReduxPackageCombiner.configure([featureToggleModule], null);
      toggleRouter = new ToggleRouter(ReduxPackageCombiner.getDispatcher());

      const configs = {
        'cta': {setting: 'contact'}
      };
      FeatureToggleActions.initialize(configs);

      toggleSetting$ = toggleRouter.watch('cta');
      toggleSetting$.subscribe((newValue) => {
        watched(newValue);
      });

      toggleRouter.setFeatureState({cta: 'value'});

    });
开发者ID:kokokenada,项目名称:common-app,代码行数:19,代码来源:feature-toggle-router.spec.ts

示例3: ngOnInit

 ngOnInit() {
     // Check for deep link
     let pathname:string[] = window.location.pathname.split('/');
     if (pathname.length>=3) {
       let subUrl:string = pathname[1];
       let gameId:string = pathname[2];
       if (subUrl === 'game-hand' || subUrl ==='game-table') {
         if (LoginPackage.lastLoginState.loggedIn)
           GameStartActions.loadGameRequest(gameId, '');
         else {
           const subscription = ReduxPackageCombiner.select(LOGIN_PACKAGE_NAME).subscribe( (loginState: ILoginState) => {
             if (loginState.loggedIn) {
               GameStartActions.loadGameRequest(gameId, '');
               subscription.unsubscribe();
             }
           } );
         }
       }
     }
 }
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:20,代码来源:top-frame.twbs.ts

示例4: watchForAutoLogin

  watchForAutoLogin(): Observable<ILoginActionPayload> {
    const isAuto = ( loginState: ILoginState ): boolean => {
      if (loginState)
        return loginState.userId === null;
      return false;
    };

    let meteorUser = Meteor.user();
    let lastLoginState = null;
    ReduxPackageCombiner
      .select(LOGIN_PACKAGE_NAME)
      .subscribe((loginState: ILoginState) => {
        lastLoginState = loginState;
      });
    if (meteorUser) {
      return Observable.of(LoginActions.loginSuccessFactory(
        this.userFromMeteorUser(meteorUser),
        meteorUser._id,
        isAuto(lastLoginState)
      ));
    }

    let subject = new Subject();
    let timer = Observable.timer(500, 1000);
    let subscription = timer.subscribe(() => {
      let meteorUser = Meteor.user();
      if (meteorUser) {
        subject.next( LoginActions.loginSuccessFactory(
          this.userFromMeteorUser(meteorUser),
          meteorUser._id,
          isAuto(lastLoginState)
        ));
        subject.complete();
        subscription.unsubscribe();
      }
    });
    return subject;
  };
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:38,代码来源:login-service-meteor.ts

示例5: configure

  configure(middleware) {

    let connectService: IConnectService;
    let loginService: ILoginService;
    let usersService: IUsersService;
    let uploaderService: IUploaderService;
    let startGameService: IGameStartService;
    let gamePlayServiceMeteor: IGamePlayService;

    if (featureToggleConfigs[FEATURE_TOGGLE_USE_FIREBASE].setting) {
      const firebaseApp = firebase.initializeApp(firebaseConfig);
      connectService = new ConnectServiceFirebase(firebaseApp);
      loginService = new LoginServiceFirebase(firebaseApp);
      usersService = new UsersServiceFirebase(firebaseApp);
      startGameService = new GamePlayStartFirebase(firebaseApp);
      gamePlayServiceMeteor = new GamePlayServiceFirebase(firebaseApp);
      uploaderService = new UploaderServiceFirebase(firebaseApp);

      uploaderCollections['avatar'] = {name: 'avatar', reference: 'avatar'};
      let avatar = new AvatarModel(firebaseApp);
      middleware.push(avatar.watchForAvatarUploadMiddleWare);

      let staticResources = new StaticResources(Meteor.absoluteUrl); // until dev environment moves

    } else {
      connectService = new ConnectServiceMeteor();
      loginService = new LoginServiceMeteor();
      usersService = new UsersServiceMeteor();
      startGameService = new GamePlayStartMeteor();
      gamePlayServiceMeteor = new GamePlayServiceMeteor();
      uploaderService = new UploaderServiceMeteor();

      uploaderCollections['avatar'] = {name: 'avatar', reference: AvatarOriginalStore};

      let staticResources = new StaticResources(Meteor.absoluteUrl);
    }
    const gameStartPackage = new GameStartPackage(startGameService);
    const gamePlayPackage = new GamePlayPackage(gamePlayServiceMeteor);
    const connectModule = new ConnectPackage(connectService);
    const loginModule = new LoginPackage(loginService);
    const featureTogglePackage = new FeatureTogglePackage();
    const uploaderPackage = new UploaderPackage(uploaderService);

    middleware.push(getAnalyticsMiddleware());
    let options : ICombinerOptions = {
      consoleLogging: featureToggleConfigs['redux-console-logging'].setting,
      otherMiddlewares: middleware
    };

    ReduxPackageCombiner.configure([
      connectModule,
      loginModule,
      new ModalModule(),
      this.accountsAdminModule,
      featureTogglePackage,
      gameStartPackage,
      gamePlayPackage,
      uploaderPackage,
      new UsersPackage(usersService)],
      this.ngRedux,
      options
    );
    FeatureToggleActions.initialize(featureToggleConfigs);
  }
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:64,代码来源:redux-modules.ts

示例6: beforeEach

 beforeEach(() => {
   ReduxPackageCombiner.setMockDispatch(watched);
 });
开发者ID:kokokenada,项目名称:common-app,代码行数:3,代码来源:login-actions.spec.ts

示例7: watchForAutoLogin

 static watchForAutoLogin() : void {
   ReduxPackageCombiner.dispatch({type: LoginActionsStrings.WATCH_USER_AUTO_LOGIN});
 }
开发者ID:kokokenada,项目名称:common-app,代码行数:3,代码来源:login-actions-private.ts

示例8: watchCurrentUser

 static watchCurrentUser() : void {
   ReduxPackageCombiner.dispatch({type: LoginActionsStrings.WATCH_CURRENT_USER});
 }
开发者ID:kokokenada,项目名称:common-app,代码行数:3,代码来源:login-actions-private.ts


注:本文中的redux-package.ReduxPackageCombiner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。