Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Action<A, E, R, AV>

Type parameters

Hierarchy

  • Action

Implements

Index

Constructors

constructor

  • new Action(...argumentTypes: A): Action
  • Parameters

    • Rest ...argumentTypes: A

    Returns Action

Properties

Readonly argumentTypes

argumentTypes: A

Optional confirmer

confirmer: undefined | ((actionApi: IActionConfirmerApi<E>, ...args: AV) => Promise<boolean>)

Readonly flags

flags: {}

Type declaration

handler

handler: (actionApi: IActionHandlerApi<E>, ...args: AV) => R

Type declaration

Optional preExecutionHandler

preExecutionHandler: undefined | ((actionApi: IActionApi<E>, ...args: AV) => any)

Readonly usability

usability: {}

Type declaration

validExecutors

validExecutors: EntityType[]

Methods

clone

execute

  • execute(actionApi: IActionApi<E>, ...args: AV): R
  • execute(executor: E, ...args: AV): R

hasFlag

  • Checks if a flag is set

    Parameters

    Returns boolean

setConfirmer

  • Add an asynchronous "confirmer" handler to this action.

    When an entity attempts to execute an action, the confirmer is the second handler called (after the pre-execution handler). Confirmer handlers are executed on the client-side only.

    Note: If you use actionApi.addItems in a pre-execution handler, a confirmation interrupt will already be shown. In that case, a confirmer is unnecessary.

    Parameters

    Returns this

    false to cancel the execution of the action.

setFlags

  • Sets additional flags for this action.

    Parameters

    Returns this

setHandler

  • setHandler<H>(handler: H): Action<A, E, H extends (...args: any) => infer R2 ? R2 : void>
  • Add a handler for this action.

    Handlers are executed on both the client-side and the server-side.

    Type parameters

    Parameters

    • handler: H

    Returns Action<A, E, H extends (...args: any) => infer R2 ? R2 : void>

setPreExecutionHandler

  • setPreExecutionHandler(handler: (actionApi: IActionApi<E>, ...args: AV) => any): this
  • Add a "pre-execution" handler to this action.

    When an entity attempts to execute an action, the pre-execution handler is the first handler called. Pre-execution handlers are executed on the client-side only.

    Parameters

    • handler: (actionApi: IActionApi<E>, ...args: AV) => any
        • Parameters

          Returns any

    Returns this

    false to cancel the execution of the action.

setUsableBy

  • Sets the entities that can use an action.

    Type parameters

    Parameters

    • Rest ...entityTypes: E2

    Returns Action<A, EntityTypeTupleType<E2>>

setUsableWhen

  • Sets additional times the action can be used in.

    Parameters

    Returns this

skipConfirmation

  • skipConfirmation(): this
  • Returns this

Generated using TypeDoc