@logux/actions
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -21,4 +21,21 @@ import { Action, AnyAction } from '@logux/core' | ||
/** | ||
* Define action creator. | ||
* | ||
* ```js | ||
* import { defineAction } from '@logux/actions' | ||
* | ||
* export const renameAction = defineAction('rename') | ||
* | ||
* renameAction({ newName: 'New' }) //=> { type: 'rename', nameName: 'New' } | ||
* renameAction.type //=> 'rename' | ||
* renameAction.match(action) //=> boolean | ||
* ``` | ||
* | ||
* @param type Action’s type. | ||
* @param creator Function to convert arguments to action object. | ||
* @returns Function which return an action. | ||
*/ | ||
interface DefineAction { | ||
<CreatedAction extends Action>(type: string): ActionCreator< | ||
<CreatedAction extends Action>(type: CreatedAction['type']): ActionCreator< | ||
CreatedAction, | ||
@@ -29,4 +46,4 @@ [Omit<CreatedAction, 'type'>] | ||
<CreatedAction extends Action, CreatorArgs extends any[]>( | ||
type: string, | ||
creator: (...args: CreatorArgs) => CreatedAction | ||
type: CreatedAction['type'], | ||
creator?: (...args: CreatorArgs) => CreatedAction | ||
): ActionCreator<CreatedAction, CreatorArgs> | ||
@@ -33,0 +50,0 @@ } |
{ | ||
"name": "@logux/actions", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Types and action creators for build-in Logux actions", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -20,4 +20,10 @@ import { Action, AnyAction } from '@logux/core' | ||
/** | ||
* Returns `logux/processed` action. | ||
*/ | ||
export const loguxProcessed: ActionCreator<LoguxProcessedAction> | ||
/** | ||
* Returns `logux/undo` action. | ||
*/ | ||
export function loguxUndo< | ||
@@ -24,0 +30,0 @@ RevertedAction extends Action = AnyAction, |
@@ -29,6 +29,15 @@ import { ActionCreator } from '../define-action/index.js' | ||
/** | ||
* Returns `logux/subscribe` action. | ||
*/ | ||
export const loguxSubscribe: ActionCreator<LoguxSubscribeAction> | ||
/** | ||
* Returns `logux/subscribed` action. | ||
*/ | ||
export const loguxSubscribed: ActionCreator<LoguxSubscribedAction> | ||
/** | ||
* Returns `logux/unsubscribe` action. | ||
*/ | ||
export const loguxUnsubscribe: ActionCreator<LoguxSubscribeAction> |
@@ -75,2 +75,18 @@ import { ActionCreator } from '../define-action/index.js' | ||
/** | ||
* Returns actions for CRDT Map. | ||
* | ||
* ```js | ||
* import { defineSyncMapActions } from '@logux/actions' | ||
* | ||
* const [ | ||
* createUserAction, | ||
* changeUserAction, | ||
* deleteUserAction, | ||
* createdUserAction, | ||
* changedUserAction, | ||
* deletedUserAction | ||
* ] = defineSyncMapActions('users') | ||
* ``` | ||
*/ | ||
export function defineSyncMapActions<Value extends SyncMapValues>( | ||
@@ -77,0 +93,0 @@ plural: string |
@@ -14,4 +14,10 @@ import { ActionCreator } from '../define-action/index.js' | ||
/** | ||
* Returns `0` action. | ||
*/ | ||
export const zero: ActionCreator<ZeroAction> | ||
/** | ||
* Returns `0/clean` action. | ||
*/ | ||
export const zeroClean: ActionCreator<ZeroCleanAction> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12094
351