API
This document describes the public API of @vue-modeler/model.
ProtoModel
Abstract base class for reactive models with action support.
Static methods
| Method | Description |
|---|---|
createModel | Wraps ProtoModel in Model<T> (proxy) so @action methods are exposed as Action |
model | Factory for Model<T> with the class constructor signature |
Instance properties (ProtoModel)
| Property | Type | Description |
|---|---|---|
hasPendingActions | boolean | Whether any action is in pending |
hasActionWithError | boolean | Whether any action is in error |
Protected methods (ProtoModel)
| Method | Description |
|---|---|
watch | Registers watch/watchEffect in the model's EffectScope |
computed | Creates computed in the model's EffectScope |
action | Returns the Action for an @action method |
setActionState | Updates aggregated action state in the model |
validateArgs | Custom argument validation (override in model) |
Public methods (ProtoModel)
| Method | Description |
|---|---|
isModelOf | Type check via instanceof |
destructor | Stops 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 errorthrowCause(): void— rethrows the causetoString(): 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.
