Skip to content

@vttforge/core / TokenDocumentLike

Interface: TokenDocumentLike<System> ​

A token's position and size on a scene.

Extends ​

Type Parameters ​

System ​

System = Record<string, unknown>

Properties ​

actor ​

readonly actor: ActorLike<Record<string, unknown>, ItemLike<Record<string, unknown>>> | null


actorId ​

readonly actorId: string | null


readonly actorLink: boolean


alpha ​

readonly alpha: number


bar1 ​

readonly bar1: object

attribute ​

attribute: string | null


bar2 ​

readonly bar2: object

attribute ​

attribute: string | null


combatant ​

readonly combatant: CombatantLike<Record<string, unknown>> | null


depth ​

readonly depth: number

New in v14, alongside level.


displayBars ​

readonly displayBars: number


displayName ​

readonly displayName: number


disposition ​

readonly disposition: number


documentName ​

readonly documentName: string

'Actor', 'Item', 'ActiveEffect', and so on.

Inherited from ​

DocumentMembers.documentName


elevation ​

readonly elevation: number


flags ​

readonly flags: DocumentFlags

Inherited from ​

DocumentMembers.flags


height ​

readonly height: number


hidden ​

readonly hidden: boolean


id ​

readonly id: string | null

Inherited from ​

DocumentMembers.id


img ​

readonly img: string | null

Inherited from ​

DocumentMembers.img


inCombat ​

readonly inCombat: boolean


isOwner ​

readonly isOwner: boolean

Whether the current user owns this document.

Inherited from ​

DocumentMembers.isOwner


level ​

readonly level: string

The Level document this token stands on. New in v14.


light ​

readonly light: Record<string, unknown>


locked ​

readonly locked: boolean


lockRotation ​

readonly lockRotation: boolean


movementAction ​

readonly movementAction: string


name ​

readonly name: string

Inherited from ​

DocumentMembers.name


object ​

readonly object: TokenObjectLike | null


parent ​

readonly parent: DocumentMembers<Record<string, unknown>> | null

The document this one is embedded in, or null at the top level.

Inherited from ​

DocumentMembers.parent


rotation ​

readonly rotation: number


shape ​

readonly shape: number


sight ​

readonly sight: object

Index Signature ​

[key: string]: unknown

enabled ​

enabled: boolean

range ​

range: number


sort ​

readonly sort: number


system ​

readonly system: System

The type data model instance. Its fields are the schema's fields.

Inherited from ​

DocumentMembers.system


texture ​

readonly texture: object

Index Signature ​

[key: string]: unknown

src ​

src: string | null


type ​

readonly type: string

The subtype, as declared under documentTypes in the manifest.

Inherited from ​

DocumentMembers.type


uuid ​

readonly uuid: string

Inherited from ​

DocumentMembers.uuid


width ​

readonly width: number


x ​

readonly x: number


y ​

readonly y: number

Methods ​

delete() ​

delete(operation?): Promise<TokenDocumentLike<System> | undefined>

Parameters ​

operation? ​

Record<string, unknown>

Returns ​

Promise<TokenDocumentLike<System> | undefined>

Inherited from ​

DocumentMembers.delete


getCenterPoint() ​

getCenterPoint(data?): object

Parameters ​

data? ​

Record<string, unknown>

Returns ​

object

elevation ​

elevation: number

x ​

x: number

y ​

y: number


getFlag() ​

getFlag<T>(scope, key): T | undefined

Type Parameters ​

T ​

T = unknown

Parameters ​

scope ​

string

key ​

string

Returns ​

T | undefined

Inherited from ​

DocumentMembers.getFlag


getSize() ​

getSize(data?): object

Parameters ​

data? ​

Record<string, unknown>

Returns ​

object

height ​

height: number

width ​

width: number


getUserLevel() ​

getUserLevel(user): number | null

Parameters ​

user ​

UserLike

Returns ​

number | null


setFlag() ​

setFlag(scope, key, value): Promise<TokenDocumentLike<System>>

Parameters ​

scope ​

string

key ​

string

value ​

unknown

Returns ​

Promise<TokenDocumentLike<System>>

Inherited from ​

DocumentMembers.setFlag


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.

ts
if (item.testUserPermission(game.user, 'LIMITED')) render(link);

Parameters ​

user ​

unknown

permission ​

number | "NONE" | "LIMITED" | "OBSERVER" | "OWNER"

options? ​
exact? ​

boolean

Returns ​

boolean

Inherited from ​

DocumentMembers.testUserPermission


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>

Inherited from ​

DocumentMembers.toObject


unsetFlag() ​

unsetFlag(scope, key): Promise<TokenDocumentLike<System>>

Parameters ​

scope ​

string

key ​

string

Returns ​

Promise<TokenDocumentLike<System>>

Inherited from ​

DocumentMembers.unsetFlag


update() ​

update(data, operation?): Promise<TokenDocumentLike<System> | undefined>

Parameters ​

data ​

Record<string, unknown>

operation? ​

Record<string, unknown>

Returns ​

Promise<TokenDocumentLike<System> | undefined>

Inherited from ​

DocumentMembers.update

MIT licensed.