當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。