Skip to content

@vttforge/core / TypeDataModelHooks

Interface: TypeDataModelHooks ​

The two hooks this base fills in, so a subclass can omit either.

Extends ​

Properties ​

parent ​

readonly parent: DocumentMembers

The document this data belongs to: the Actor or Item whose system this is. Inside prepareDerivedData() this is how you read the rest of the document, this.parent.name or this.parent.items.

Foundry types it nullable because a DataModel can stand on its own. A type data model cannot: Foundry builds it with the document as parent.

Inherited from ​

TypeDataModelMembers.parent

Methods ​

prepareBaseData() ​

prepareBaseData(): void

Returns ​

void


prepareDerivedData() ​

prepareDerivedData(): void

Returns ​

void


toObject() ​

toObject(source?): Record<string, unknown>

A plain-object copy of the data.

Parameters ​

source? ​

boolean

Returns ​

Record<string, unknown>

Inherited from ​

TypeDataModelMembers.toObject


updateSource() ​

updateSource(changes?, options?): Record<string, unknown>

Change the source data in memory, without a database write.

Parameters ​

changes? ​

Record<string, unknown>

options? ​

Record<string, unknown>

Returns ​

Record<string, unknown>

Inherited from ​

TypeDataModelMembers.updateSource

MIT licensed.