• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript effects.EffectsModule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Http

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


示例2:

import { LoginPage } from '../pages/user/login';
import { CreateAccountPage } from '../pages/createAccount/createAccount';
import { ListStuffPage } from '../pages/listStuff/listStuff';
import { AddStuffModal } from '../pages/listStuff/addStuffModal';

// PROVIDERS 
import { Authentication } from '../providers/authentication'

import { AuthenticationReducer } from './../reducers/authentication';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';


const appEffectsRun = [
  EffectsModule.run(AuthEffects),
  EffectsModule.run(TodoEffects),
];

@NgModule({
  declarations: [
    MyApp,
    HomePage,
    CreateAccountPage,
    LoginPage,
    ListStuffPage,
    AddStuffModal
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    StoreModule.provideStore({ auth: AuthenticationReducer, todos: TodoReducer }),
开发者ID:aaronksaunders,项目名称:kinvey-starter-ionic2,代码行数:31,代码来源:app.module.ts


示例3:

import { BootEffects } from "./boot.effect";
import { PatientEffects } from './patient.effect';
import { SessionsEffects } from './sessions.effect';
import { PaymentsEffects } from './payments.effect';
import { PatientsEffects } from './patients.effect';
import { StoreEffects } from './store.effect';
import { StoreActionsEffects } from './storeActions.effect';
import { DiaryEffects } from './diary.effect';
import { MessagesEffects } from './messages.effect';
import { BackupEffects } from './backup.effect';
import { AppointmentsEffects } from './appointments.effect';
import { SearchsEffects } from './searchs.effect';
import { AuthEffects } from './auth.effect';

export const EFFECTS = EffectsModule.forRoot([
	PatientEffects,
	SessionsEffects,
	StoreEffects,
	StoreActionsEffects,
	DiaryEffects,
	MessagesEffects,
	PaymentsEffects,
	BackupEffects,
	PatientsEffects,
	AppointmentsEffects,
	SearchsEffects,
	AuthEffects,
	BootEffects, // Should always remain last https://github.com/ngrx/platform/issues/103#issuecomment-316813618
]);
开发者ID:jogboms,项目名称:ClinicRegistry,代码行数:29,代码来源:index.ts


示例4: combineReducers

  profile: IProfile;
  weather: IWeather;
}

// all new reducers should be define here
const reducers = {
  feed: feedReducer,
  profile: profileReducer,
  weather: weatherReducer
};

const productionReducer: ActionReducer<IAppState> = combineReducers(reducers);
const developmentReducer: ActionReducer<IAppState> = compose(storeFreeze, combineReducers)(reducers);

export function reducer(state: IAppState, action: Action) {
  if (environment.production) {
    return productionReducer(state, action);
  } else {
    return developmentReducer(state, action);
  }
}

export const store: ModuleWithProviders = StoreModule.provideStore(reducer);
export const instrumentation: ModuleWithProviders =  (!environment.production) ? StoreDevtoolsModule.instrumentOnlyWithExtension() : null;

export const effects: ModuleWithProviders[] = [
  EffectsModule.run(ProfileEffects),
  EffectsModule.run(FeedEffects),
  EffectsModule.run(WeatherEffects)
];
开发者ID:akazimirov,项目名称:domic,代码行数:30,代码来源:index.ts


示例5:

import { EffectsModule } from '@ngrx/effects';
import { TenantEffects } from './tenant.effects';

export const EFFECTS = [
  EffectsModule.run(TenantEffects),
];
开发者ID:llstarscreamll,项目名称:multi-tenant-app,代码行数:6,代码来源:index.ts


示例6: heroesComponentClassSetup

function heroesComponentClassSetup() {
  TestBed.configureTestingModule({
    imports: [StoreModule.forRoot({}), EffectsModule.forRoot([]), CoreModule, EntityStoreModule],
    providers: [
      Actions,
      AppEntityServices,
      AppSelectors,
      HeroesComponent, // When testing class-only
      HeroesService,
      { provide: HttpClient, useValue: null },
      { provide: NgrxDataToastService, useValue: null }
    ]
  });

  // Component listens for toggle between local and remote DB
  const appSelectorsDataSource = new BehaviorSubject('local');
  const appSelectors: AppSelectors = TestBed.get(AppSelectors);
  spyOn(appSelectors, 'dataSource$').and.returnValue(appSelectorsDataSource);

  // Create Hero entity actions as ngrx-data will do it
  const entityActionFactory: EntityActionFactory = TestBed.get(EntityActionFactory);
  function createHeroAction(op: EntityOp, data?: any, options?: EntityActionOptions) {
    return entityActionFactory.create('Hero', op, data, options);
  }

  // Spy on EntityEffects
  const effects: EntityEffects = TestBed.get(EntityEffects);
  let persistResponsesSubject: ReplaySubject<Action>;

  const persistSpy = spyOn(effects, 'persist').and.callFake(
    (action: EntityAction) => (persistResponsesSubject = new ReplaySubject<Action>(1))
  );

  // Control EntityAction responses from EntityEffects spy
  function setPersistResponses(...actions: Action[]) {
    actions.forEach(action => persistResponsesSubject.next(action));
    persistResponsesSubject.complete();
  }

  // Sample Hero test data
  const initialHeroes = [
    { id: 1, name: 'A', saying: 'A says' },
    { id: 3, name: 'B', saying: 'B says' },
    { id: 2, name: 'C', saying: 'C says' }
  ];

  // Spy on dispatches to the store (not very useful)
  const testStore: Store<EntityCache> = TestBed.get(Store);
  const dispatchSpy = spyOn(testStore, 'dispatch').and.callThrough();

  return {
    appSelectorsDataSource,
    createHeroAction,
    dispatchSpy,
    effects,
    entityActionFactory,
    initialHeroes,
    persistResponsesSubject,
    persistSpy,
    setPersistResponses,
    testStore
  };
}
开发者ID:RajeevSingh273,项目名称:angular-ngrx-data,代码行数:63,代码来源:heroes.component.effects.spec.ts


示例7:

import { EffectsModule } from '@ngrx/effects';

import { AppPlayerEffects } from './app-player.effects';
import { NowPlaylistEffects } from './now-playlist.effects';
import { UserProfileEffects } from './user-profile.effects';
import { PlayerSearchEffects } from './player-search.effects';
import { AppSettingsEffects } from './app-settings.effects';
import { RouterEffects } from './router.effects';

export const AppEffectsModules = EffectsModule.forRoot([
  AppPlayerEffects,
  NowPlaylistEffects,
  UserProfileEffects,
  PlayerSearchEffects,
  AppSettingsEffects,
  RouterEffects
]);
开发者ID:blackshadow17,项目名称:echoPlayer,代码行数:17,代码来源:index.ts


示例8: useLogMonitor

import { routes } from './app.routing';
import { rootReducer } from './reducers';
import { StoreDevToolsModule } from './features/store-devtools.module';
import { UserEffects } from './user/user.effects';

const STORE_DEV_TOOLS_IMPORTS = [];
if (ENV === 'development' && !AOT &&
  ['monitor', 'both'].includes(STORE_DEV_TOOLS) // set in constants.js file in project root
) STORE_DEV_TOOLS_IMPORTS.push(...[
  StoreDevtoolsModule.instrumentStore({
    monitor: useLogMonitor({
      visible: true,
      position: 'right'
    })
  })
]);

export const APP_IMPORTS = [
  EffectsModule.run(UserEffects),
  MaterialModule.forRoot(),
  ReactiveFormsModule,
  IdlePreloadModule.forRoot(), // forRoot ensures the providers are only created once
  RouterModule.forRoot(routes, { useHash: false, preloadingStrategy: IdlePreload }),
  RouterStoreModule.connectRouter(),
  StoreModule.provideStore(rootReducer),
  STORE_DEV_TOOLS_IMPORTS,
  StoreDevToolsModule
];

开发者ID:Ecafracs,项目名称:flatthirteen,代码行数:28,代码来源:app.imports.ts


示例9:

import { EffectsModule } from '@ngrx/effects';

import { RequestEffect } from '../effects/request.effect';

export const EffectsModuleImport = EffectsModule.forRoot([
  RequestEffect
]);
开发者ID:atSistemas,项目名称:angular-base,代码行数:7,代码来源:effects.imports.ts


示例10: combineReducers

const productionReducer: ActionReducer<IAppState> = combineReducers(reducers);
const developmentReducer: ActionReducer<IAppState> = compose(storeFreeze, combineReducers)(reducers);

export function reducer(state: IAppState, action: Action) {
  if (environment.production) {
    return productionReducer(state, action);
  } else {
    return developmentReducer(state, action);
  }
}

@NgModule()
export class DummyModule {

  static forRoot(): ModuleWithProviders {
    return {
      ngModule: CommonModule
    };
  }
}

export const store: ModuleWithProviders = StoreModule.provideStore(reducer);
export const instrumentation: ModuleWithProviders =
  (!environment.production) ? StoreDevtoolsModule.instrumentOnlyWithExtension() : DummyModule.forRoot();

export const effects: ModuleWithProviders[] = [
  EffectsModule.run(ProfileEffects),
  EffectsModule.run(FeedEffects)
];
开发者ID:venki143mca,项目名称:TeamBirthday,代码行数:29,代码来源:index.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript testing.provideMockActions函数代码示例发布时间:2022-05-28
下一篇:
TypeScript effects.Actions类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap