Class TJSDocument<T>
Type Parameters
Index
Constructors
Accessors
Methods
Constructors
constructor
- new TJSDocument<T>(document?, options?): TJSDocument<T>
Type Parameters
Parameters
Optional
document: T | TJSDocumentOptionsDocument to wrap or TJSDocumentOptions.
Optional
options: TJSDocumentOptionsTJSDocument options.
Returns TJSDocument<T>
Accessors
embedded
- get embedded(): EmbeddedAPI
Returns EmbeddedAPI
Embedded store manager.
updateOptions
- get updateOptions(): TJSDocumentUpdateOptions
Returns the options passed on last update.
Returns TJSDocumentUpdateOptions
Last update options.
uuidv4
- get uuidv4(): string
Returns the UUID assigned to this store.
Returns string
UUID
Methods
destroy
get
set
- set(document, options?): void
Parameters
- document: T
New document to set.
Optional
options: TJSDocumentUpdateOptionsNew document update options to set.
Returns void
- document: T
setFromDataTransfer
- set
From (data, options?): Promise<boolean>Data Transfer Potentially sets new document from data transfer object.
Parameters
- data: object
Document transfer data.
Optional
options: {
compendium?: boolean;
types?: string[];
world?: boolean;
}Optional parameters for TJSDocument.getUUIDFromDataTransfer.
Optional
compendium?: booleanOptional
types?: string[]Optional
world?: boolean
Returns Promise<boolean>
Returns true if new document set from data transfer blob.
- data: object
setFromUUID
- set
FromUUID (uuid, options?): Promise<boolean> Sets the document by Foundry UUID performing a lookup and setting the document if found.
Parameters
- uuid: string
A Foundry UUID to lookup.
Optional
options: TJSDocumentUpdateOptionsNew document update options to set.
Returns Promise<boolean>
True if successfully set document from UUID.
- uuid: string
setOptions
- set
Options (options): void Sets options for this document wrapper / store.
Parameters
- options: TJSDocumentOptions
Options for TJSDocument.
Returns void
- options: TJSDocumentOptions
subscribe
- subscribe(handler): Unsubscriber
Parameters
- handler: ((value: T, updateOptions?: TJSDocumentUpdateOptions) => void)
Callback function that is invoked on update / changes.
- (value, updateOptions?): void
Parameters
- value: T
Optional
updateOptions: TJSDocumentUpdateOptions
Returns void
Returns Unsubscriber
Unsubscribe function.
- handler: ((value: T, updateOptions?: TJSDocumentUpdateOptions) => void)
Static
getUUIDFromDataTransfer
- getUUIDFrom
Data (data, opts?): stringTransfer Attempts to create a Foundry UUID from standard drop data. This may not work for all systems.
Parameters
- data: object
Drop transfer data.
Optional
opts: {
compendium?: boolean;
types?: string[];
world?: boolean;
}Optional parameters.
Optional
compendium?: booleanAccept compendium documents.
Optional
types?: string[]Require the
data.type
to match entry intypes
.Optional
world?: booleanAccept world documents.
Returns string
Foundry UUID for drop data.
- data: object
Provides a wrapper implementing the Svelte store / subscriber protocol around any Document / ClientMixinDocument. This makes documents reactive in a Svelte component, but otherwise provides subscriber functionality external to Svelte.