@ngxs/store
Version:
71 lines (66 loc) • 2.08 kB
TypeScript
import { ɵPlainObject as _PlainObject } from '@ngxs/store/internals';
import { InjectionToken, Type } from '@angular/core';
/**
* Init action
*/
declare class InitState {
static readonly type = "@@INIT";
}
/**
* Update action
*/
declare class UpdateState {
readonly addedStates?: _PlainObject | undefined;
static readonly type = "@@UPDATE_STATE";
constructor(addedStates?: _PlainObject | undefined);
}
type NgxsNextPluginFn = (state: any, action: any) => any;
type NgxsPluginFn = (state: any, action: any, next: NgxsNextPluginFn) => any;
/**
* Plugin interface
*/
interface NgxsPlugin {
/**
* Handle the state/action before its submitted to the state handlers.
*/
handle(state: any, action: any, next: NgxsNextPluginFn): any;
}
/**
* A multi-provider token used to resolve to custom NGXS plugins provided
* at the root and feature levels through the `{provide}` scheme.
*
* @deprecated from v18.0.0, use `withNgxsPlugin` instead.
*/
declare const NGXS_PLUGINS: InjectionToken<NgxsPlugin[]>;
declare function ɵisPluginClass(plugin: Type<NgxsPlugin> | NgxsPluginFn): plugin is Type<NgxsPlugin>;
/**
* Returns the type from an action instance/class.
* @ignore
*/
declare function getActionTypeFromInstance(action: any): string | undefined;
/**
* Matches a action
* @ignore
*/
declare function actionMatcher(action1: any): (action2: any) => boolean;
/**
* Set a deeply nested value. Example:
*
* setValue({ foo: { bar: { eat: false } } },
* 'foo.bar.eat', true) //=> { foo: { bar: { eat: true } } }
*
* While it traverses it also creates new objects from top down.
*
* @ignore
*/
declare const setValue: (obj: any, prop: string, val: any) => any;
/**
* Get a deeply nested value. Example:
*
* getValue({ foo: bar: [] }, 'foo.bar') //=> []
*
* @ignore
*/
declare const getValue: (obj: any, prop: string) => any;
export { InitState, NGXS_PLUGINS, UpdateState, actionMatcher, getActionTypeFromInstance, getValue, setValue, ɵisPluginClass };
export type { NgxsNextPluginFn, NgxsPlugin, NgxsPluginFn };