@vttforge/core / DocumentMembers
Interface: DocumentMembers<System> ​
What every document carries, whatever kind it is.
System is the document's system data. It defaults to an open record, so a consumer who has not said what their schema is still compiles; pass the inferred type from BaseTypeDataModel to get the fields.
Extended by ​
ActiveEffectLikeActorLikeItemLikeChatMessageLikeCombatantLikeCombatLikeFolderLikeDocumentJournalEntryLikeLevelLikeMacroLikeSceneLikeTokenDocumentLikeUserLike
Type Parameters ​
System ​
System = Record<string, unknown>
Properties ​
documentName ​
readonlydocumentName:string
'Actor', 'Item', 'ActiveEffect', and so on.
flags ​
readonlyflags:DocumentFlags
id ​
readonlyid:string|null
img ​
readonlyimg:string|null
isOwner ​
readonlyisOwner:boolean
Whether the current user owns this document.
name ​
readonlyname:string
parent ​
readonlyparent:DocumentMembers<Record<string,unknown>> |null
The document this one is embedded in, or null at the top level.
system ​
readonlysystem:System
The type data model instance. Its fields are the schema's fields.
type ​
readonlytype:string
The subtype, as declared under documentTypes in the manifest.
uuid ​
readonlyuuid:string
Methods ​
delete() ​
delete(
operation?):Promise<DocumentMembers<System> |undefined>
Parameters ​
operation? ​
Record<string, unknown>
Returns ​
Promise<DocumentMembers<System> | undefined>
getFlag() ​
getFlag<
T>(scope,key):T|undefined
Type Parameters ​
T ​
T = unknown
Parameters ​
scope ​
string
key ​
string
Returns ​
T | undefined
setFlag() ​
setFlag(
scope,key,value):Promise<DocumentMembers<System>>
Parameters ​
scope ​
string
key ​
string
value ​
unknown
Returns ​
Promise<DocumentMembers<System>>
testUserPermission() ​
testUserPermission(
user,permission,options?):boolean
Whether a user has at least this level of access to the document.
isOwner answers the same question for the current user and the highest level. This answers it for any user and any level, which is what a package asks before it shows someone another person's document.
if (item.testUserPermission(game.user, 'LIMITED')) render(link);Parameters ​
user ​
unknown
permission ​
number | "NONE" | "LIMITED" | "OBSERVER" | "OWNER"
options? ​
exact? ​
boolean
Returns ​
boolean
toObject() ​
toObject(
source?):Record<string,unknown>
A plain-object copy. source reads the stored data instead of the prepared data.
Parameters ​
source? ​
boolean
Returns ​
Record<string, unknown>
unsetFlag() ​
unsetFlag(
scope,key):Promise<DocumentMembers<System>>
Parameters ​
scope ​
string
key ​
string
Returns ​
Promise<DocumentMembers<System>>
update() ​
update(
data,operation?):Promise<DocumentMembers<System> |undefined>
Parameters ​
data ​
Record<string, unknown>
operation? ​
Record<string, unknown>
Returns ​
Promise<DocumentMembers<System> | undefined>