Shared
Variable: Shared
constShared: {(value,context):any; (...args): (value,context) =>any; }
Defined in: packages/core/src/models/decorator.ts:76
Marker decorator for a model method shared with the frontend SDK (@webda/sdk)
The runtime decorator is a no-op; the compiler copies the method's source into ModelMetadata.Shared and the SDK
generator inlines it into the generated model class, so the method runs identically on both sides. The compiler
enforces that the body is pure: it may only use its parameters, this.<attribute>, this.<other @Shared method>,
<Model>.<static @Shared method>, the standard globals (Date, Math, JSON, Array...) and identifiers imported
from the allowlisted modules (sharedImports, @webda/utils and @webda/ql by default). Anything else fails the
build.
@Shared()
isOverdue(now: Date = new Date()): boolean {
return this.status === "open" && this.due < now;
}
Call Signature
(
value,context):any
Parameters
value
any
context
any
Returns
any
Call Signature
(...
args): (value,context) =>any
Parameters
args
...[]
Returns
(value, context) => any