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


TypeScript StoreModule.provideStore方法代码示例

本文整理汇总了TypeScript中@ngrx/store.StoreModule.provideStore方法的典型用法代码示例。如果您正苦于以下问题:TypeScript StoreModule.provideStore方法的具体用法?TypeScript StoreModule.provideStore怎么用?TypeScript StoreModule.provideStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ngrx/store.StoreModule的用法示例。


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

示例1: provideConsoleTarget

const testModuleConfig = (languages?: Array<ILang>) => {
  let providers = [
    provideConsoleTarget(LogLevel.Debug),
    { provide: LanguageViewHelper, useValue: null }
  ];
  if (languages) {
    providers.push({
      provide: Languages,
      useValue: languages
    });
  }
  TestBed.configureTestingModule({
    imports: [
      CoreModule.forRoot([
        { provide: WindowService, useValue: window },
        { provide: ConsoleService, useValue: console }
      ]),
      SharedModule,
      RouterTestingModule,
      AnalyticsModule,
      MultilingualModule,
      StoreModule.provideStore({ i18n: reducer })
    ],
    declarations: [TestComponent],
    providers
  });
  TestBed.compileComponents();
};
开发者ID:hellofornow,项目名称:angular2-seed-advanced,代码行数:28,代码来源:lang-switcher.component.spec.ts

示例2:

const testModuleConfig = (options?: any) => {
  let langProvider = [];
  if (options.languages) {
    langProvider.push({
      provide: Languages,
      useValue: options.languages
    });
  }
  TestBed.configureTestingModule({
    imports: [
      CoreModule.forRoot([
        { provide: WindowService, useValue: window },
        { provide: ConsoleService, useValue: console }
      ]),
      Angulartics2Module.forRoot([
        Angulartics2Segment
      ]),
      StoreModule.provideStore({ i18n: reducer }),
      EffectsModule.run(MultilingualEffects),
      RouterTestingModule
    ],
    providers: [
      TEST_CORE_PROVIDERS(options),
      TEST_MULTILINGUAL_PROVIDERS(),
      langProvider
    ]
  });
  TestBed.compileComponents();
};
开发者ID:hellofornow,项目名称:angular2-seed-advanced,代码行数:29,代码来源:multilingual.service.spec.ts

示例3: Http

const testModuleConfig = () => {
  TestBed.configureTestingModule({
    imports: [
      NoopAnimationsModule,
      CoreModule,
      RouterTestingModule,
      AnalyticsModule,
      MultilingualModule,
      StoreModule.provideStore({ home: homeReducer }),
      EffectsModule.run(NameListEffects),
      MdInputModule,
      MdButtonModule
    ],
    declarations: [ HomeComponent, TestComponent ],
    providers: [
      NameListService,
      BaseRequestOptions,
      MockBackend,
      provideConsoleTarget(LogLevel.Debug),
      {
        provide: Http,
        useFactory: function (backend: ConnectionBackend, defaultOptions: BaseRequestOptions) {
          return new Http(backend, defaultOptions);
        },
        deps: [ MockBackend, BaseRequestOptions ]
      }
    ]
  });
};
开发者ID:our-city-app,项目名称:plugin-homepage-example,代码行数:29,代码来源:home.component.spec.ts

示例4: Http

const testModuleConfig = () => {
  TestBed.configureTestingModule({
    imports: [
      CoreModule,
      SharedModule,
      RouterTestingModule,
      AnalyticsModule,
      MultilingualModule,
      StoreModule.provideStore({ sample: reducer }),
      EffectsModule.run(SampleEffects)
    ],
    declarations: [HomeComponent, TestComponent],
    providers: [
      LanguageProviders,
      NameListService,
      BaseRequestOptions,
      MockBackend,
      {
        provide: Http, useFactory: function (backend: ConnectionBackend, defaultOptions: BaseRequestOptions) {
          return new Http(backend, defaultOptions);
        },
        deps: [MockBackend, BaseRequestOptions]
      }
    ]
  });
};
开发者ID:hellofornow,项目名称:angular2-seed-advanced,代码行数:26,代码来源:home.component.spec.ts

示例5: beforeEach

 beforeEach(async(() => {
   TestBed.configureTestingModule({
     imports: [StoreModule.provideStore({})],
     declarations: [ ActivityWidgetComponent ]
   })
   .compileComponents();
 }));
开发者ID:syafiqrokman,项目名称:angular5-iot-dashboard,代码行数:7,代码来源:activity-widget.component.spec.ts

示例6: beforeEach

 beforeEach(async(() => {
   TestBed.configureTestingModule({
     declarations: [RegistrationPdfComponent],
     imports: [StoreModule.provideStore({ employerStore: reducer }, {})]
   })
     .compileComponents();
 }));
开发者ID:mnitdeed,项目名称:angular2-nativescript-auth0,代码行数:7,代码来源:registration-pdf.component.spec.ts

示例7: getTestBed

function createStore<T>(reducer: ActionReducer<T>, options: StoreDevtoolsConfig = {}): Fixture<T> {
  TestBed.configureTestingModule({
    imports: [
      StoreModule.provideStore(reducer),
      StoreDevtoolsModule.instrumentStore(options)
    ]
  });

  const testbed: TestBed = getTestBed();
  const store: Store<T> = testbed.get(Store);
  const devtools: StoreDevtools = testbed.get(StoreDevtools);
  const state: State<T> = testbed.get(State);
  let liftedValue: LiftedState;
  let value: T;

  const liftedStateSub = devtools.liftedState.subscribe(s => liftedValue = s);
  const stateSub = devtools.state.subscribe(s => value = s);

  const getState = (): T => value;
  const getLiftedState = (): LiftedState => liftedValue;

  const cleanup = () => {
    liftedStateSub.unsubscribe();
    stateSub.unsubscribe();
  };

  const replaceReducer = reducer => {
    store.replaceReducer(reducer);
  };


  return { store, state, devtools, cleanup, getState, getLiftedState, replaceReducer };
}
开发者ID:ngrx,项目名称:store-devtools,代码行数:33,代码来源:store.spec.ts

示例8: beforeEach

 beforeEach(async(() => {
   TestBed.configureTestingModule({
     declarations: [ AppComponent ],
     imports: [ StoreModule.provideStore(rootReducer) ],
     schemas: [NO_ERRORS_SCHEMA],
     providers: [HomeActions]
   })
   .compileComponents(); // compile template and css
 }));
开发者ID:greg9504,项目名称:angular-electron-dream-starter,代码行数:9,代码来源:app.component.spec.ts

示例9: appReducersGenerator

export function appReducersGenerator () {
    return StoreModule.provideStore({
        devices: devicesReducer,
        locations: locationsReducer,
        activities: activitiesReducer,
        widgets: widgetsReducer,
        roles: rolesReducer
    });
}
开发者ID:syafiqrokman,项目名称:angular5-iot-dashboard,代码行数:9,代码来源:app.reducers.ts

示例10: beforeEach

 beforeEach(() => {
   TestBed.configureTestingModule({
     providers: [ArticleService],
     imports: [
       // use empty reducer for now
       StoreModule.provideStore( () => {})
     ]
   });
 });
开发者ID:benwfreed,项目名称:eatlanta-client,代码行数:9,代码来源:article.service.spec.ts


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