本文整理汇总了TypeScript中@ngrx/store-devtools.instrumentStore函数的典型用法代码示例。如果您正苦于以下问题:TypeScript instrumentStore函数的具体用法?TypeScript instrumentStore怎么用?TypeScript instrumentStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了instrumentStore函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: main
export function main(initialHmrState?: any): Promise<any> {
return bootstrap(App, [
// To add more vendor providers please look in the platform/ folder
...PLATFORM_PROVIDERS,
...ENV_PROVIDERS,
...APP_PROVIDERS,
instrumentStore({
monitor: useLogMonitor({
visible: true,
position: 'right'
})
}),
provideStore({})
])
.then(decorateComponentRef)
.catch(err => console.error(err));
}
示例2: enableProdMode
import { provideStore } from '@ngrx/store'
import { instrumentStore } from '@ngrx/store-devtools'
import { useLogMonitor } from '@ngrx/store-log-monitor'
import { runEffects } from '@ngrx/effects'
import { AppComponent, environment } from './app/'
import { giphy as reducer } from './app/reducers/giphy'
import { GiphyEffects } from './app/effects/giphy'
import services from './app/services/index'
import { GiphyActions } from './app/actions/giphy'
if (environment.production) {
enableProdMode()
}
bootstrap(AppComponent, [
provideStore({ giphy: reducer }),
runEffects([ GiphyEffects ]),
services,
[GiphyActions],
instrumentStore({
monitor: useLogMonitor({
visible: true,
position: 'right'
})
})
])
示例3: provideDB
* Override the default location strategy with `HashLocationStrategy`
*/
{ provide: LocationStrategy, useClass: HashLocationStrategy },
/**
* provideDB sets up @ngrx/db with the provided schema and makes the Database
* service everywhere.
*/
provideDB(schema),
/**
* instrumentStore() sets up the @ngrx/store-devtools providers
*/
instrumentStore({
monitor: useLogMonitor({
position: 'right',
visible: true
})
}),
/**
* Finall we provide additional services and action creators so they can
* be used by all of our components, effects, and guards.
*/
services,
actions,
guards,
disableDeprecatedForms(),
provideForms()
]);
示例4: useLogMonitor
import {Provider} from '@angular/core';
import {provideStore} from '@ngrx/store';
import {instrumentStore} from '@ngrx/store-devtools';
import {useLogMonitor} from '@ngrx/store-log-monitor';
// Reducers
import {counterReducer} from '../counter/counter.reducer';
export interface AppState {
counter: number;
}
export const STORE_PROVIDERS: Provider[] = [
...provideStore(
{
counter: counterReducer
}, {
counter: 55
}
),
...instrumentStore({
monitor: useLogMonitor({
// Default log monitor options
position: 'bottom',
visible: false,
size: 0.3
})
}),
];
示例5: disableDeprecatedForms
import { provideStore } from '@ngrx/store';
import { peopleReducer } from './app/reducers/peopleReducer';
import { partyFilter } from './app/reducers/partyFilterReducer';
import { instrumentStore } from '@ngrx/store-devtools';
import { useLogMonitor } from '@ngrx/store-log-monitor';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import "angular2-materialize";
let providers = [
disableDeprecatedForms(),
provideForms(),
provideStore({people: peopleReducer, partyFilter: partyFilter})
];
if (environment.production) {
enableProdMode();
}
if (!environment.production) {
providers.push(instrumentStore({
monitor: useLogMonitor({
visible: false,
position: 'bottom'
})
}));
}
bootstrap(AppComponent, providers).catch((e) => {
console.log(e);
}) ;
示例6: bootstrap
import {bootstrap} from "@angular/platform-browser-dynamic";
import {HashLocationStrategy, LocationStrategy, APP_BASE_HREF} from "@angular/common";
import "rxjs/add/operator/do";
import {store} from "./common/store";
import {HTTP_PROVIDERS} from "@angular/http";
import {instrumentStore} from "@ngrx/store-devtools";
import {provideStore} from "@ngrx/store";
import {useLogMonitor} from "@ngrx/store-log-monitor";
import {AppRoutes} from "./common/routes";
import {provideRouter} from "@angular/router";
import {provideForms} from "@angular/forms";
import {AuthenticatedGuard} from "./common/authenticated.guard";
bootstrap(WineCellarApp, [
provideRouter(AppRoutes),
HTTP_PROVIDERS,
{provide: APP_BASE_HREF, useValue: "/"},
{provide: LocationStrategy, useClass: HashLocationStrategy},
provideForms(),
provideStore(store),
AuthenticatedGuard,
instrumentStore({
monitor: useLogMonitor({
visible: false,
position: "right"
})
}),
])
.catch((err: any) => console.error(err));
示例7: nativeScriptBootstrap
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {AppComponent} from "./app.component";
import {provideStore} from '@ngrx/store';
global.window = {};
import {instrumentStore} from '@ngrx/store-devtools';
global.window = undefined;
import {board} from './board';
import "rxjs/add/operator/do";
// const actionLog: Middleware = action => {
// return action.do(val => {
// console.log('DISPATCHED ACTION: ' + JSON.stringify(val));
// });
// };
// const stateLog: Middleware = state => {
// return state.do(val => {
// console.log('NEW STATE: ' + JSON.stringify(val));
// });
// };
// instrumentStore();
nativeScriptBootstrap(AppComponent, [
provideStore({ board }),
// usePreMiddleware(actionLog),
// usePostMiddleware(stateLog),
instrumentStore()
]);