Skip to content

API

This document describes the public API of @vue-modeler/model.

ProtoModel

Abstract base class for reactive models with action support.

Static methods

MethodDescription
createModelWraps ProtoModel in Model<T> (proxy) so @action methods are exposed as Action
modelFactory for Model<T> with the class constructor signature

Instance properties (ProtoModel)

PropertyTypeDescription
hasPendingActionsbooleanWhether any action is in pending
hasActionWithErrorbooleanWhether any action is in error

Protected methods (ProtoModel)

MethodDescription
watchRegisters watch/watchEffect in the model's EffectScope
computedCreates computed in the model's EffectScope
actionReturns the Action for an @action method
setActionStateUpdates aggregated action state in the model
validateArgsCustom argument validation (override in model)

Public methods (ProtoModel)

MethodDescription
isModelOfType check via instanceof
destructorStops watchers and the model's EffectScope

Action

Class representing an action (decorated method) with execution state and control.

See Action for static/instance properties and methods: name, owner, state, exec, abort, lock, unlock, resetError, etc.

ActionLike

Interface describing the public contract of Action without implementation details.

ActionError

Error class for exceptions thrown during action execution. Stored in Action.error. Should be handled and shown in the UI.

Constructor / Properties / Methods

  • cause: Error — original error
  • throwCause(): void — rethrows the cause
  • toString(): string — message from cause

Types

Helper types used in the public API: ActionStateName, Model<T>, OriginalMethod, OriginalMethodWrapper.

Internal errors

Error classes for invalid action lifecycle/state: ActionStatusConflictError, ActionUnexpectedAbortError, ActionInternalError.

Released under the MIT License.