Options
All
  • Public
  • Public/Protected
  • All
Menu

The singleton collection of JournalEntry documents which exist within the active World. This Collection is accessible within the Game object as game.journal.

see

JournalEntry The JournalEntry document

see

JournalDirectory The JournalDirectory sidebar directory

Hierarchy

Index

Constructors

Accessors

  • get folders(): Collection<string, Folder>
  • Reference the set of Folders which contain documents in this collection

    Returns Collection<string, Folder>

  • Return a reference to the SidebarDirectory application for this WorldCollection.

    Returns DocumentDirectory

  • get documentClass(): Function
  • A reference to the Document class definition which is contained within this DocumentCollection.

    Returns Function

  • get documentName(): any
  • inheritdoc

    Returns any

  • get name(): string
  • The Collection class name

    Returns string

  • Return a reference to the singleton instance of this WorldCollection, or null if it has not yet been created.

    Returns WorldCollection

  • Return an array of currently registered sheet classes for this Document type.

    static

    Returns DocumentSheet[]

Methods

  • _getVisibleTreeContents(entry: any): any
  • importFromCompendium(pack: CompendiumCollection, id: string, updateData?: any, options?: any): Promise<Document>
  • Import a Document from a Compendium collection, adding it to the current World.

    Parameters

    • pack: CompendiumCollection

      The CompendiumCollection instance from which to import

    • id: string

      The ID of the compendium entry to import

    • updateData: any = {}
    • options: any = {}

    Returns Promise<Document>

    The imported Document instance

  • fromCompendium(document: any, [options]?: { addFlags: boolean; clearFolder: boolean; clearSort: boolean; clearOwnership: boolean; keepId: boolean }): any
  • Apply data transformations when importing a Document from a Compendium pack

    Parameters

    • document: any

      The source Document, or a plain data object

    • [options]: { addFlags: boolean; clearFolder: boolean; clearSort: boolean; clearOwnership: boolean; keepId: boolean } = {}

      Additional options which modify how the document is imported

      • addFlags: boolean
      • clearFolder: boolean
      • clearSort: boolean
      • clearOwnership: boolean
      • keepId: boolean

    Returns any

    The processed data ready for world Document creation

  • createDocument(data: any, context?: any): Document
  • Instantiate a Document for inclusion in the Collection.

    Parameters

    • data: any

      The Document data.

    • context: any = {}

    Returns Document

  • getInvalid(id: string, [options]?: { strict: boolean }): Document
  • Obtain a temporary Document instance for a document id which currently has invalid source data.

    throws

    If strict is true and the requested ID is not in the set of invalid IDs for this collection.

    Parameters

    • id: string

      A document ID with invalid source data.

    • [options]: { strict: boolean } = {}

      Additional options to configure retrieval.

      • strict: boolean

    Returns Document

    An in-memory instance for the invalid Document

  • get(id: string, [options]?: { strict: boolean; invalid: boolean }): Document
  • Get an element from the DocumentCollection by its ID.

    throws

    If strict is true and the Document cannot be found.

    Parameters

    • id: string

      The ID of the Document to retrieve.

    • [options]: { strict: boolean; invalid: boolean } = {}

      Additional options to configure retrieval.

      • strict: boolean
      • invalid: boolean

    Returns Document

  • set(id: any, document: any): void
  • delete(id: any): void
  • render(force: any, options: any): void
  • Render any Applications associated with this DocumentCollection.

    Parameters

    • force: any
    • options: any

    Returns void

  • search(search: { query: string; filters: FieldFilter[]; exclude: string[] }): string[]
  • Find all Documents which match a given search term using a full-text search against their indexed HTML fields and their name. If filters are provided, results are filtered to only those that match the provided values.

    Parameters

    • search: { query: string; filters: FieldFilter[]; exclude: string[] }

      An object configuring the search

    Returns string[]

  • updateAll(transformation: any, condition?: Function, options?: any): Promise<Document[]>
  • Update all objects in this DocumentCollection with a provided transformation. Conditionally filter to only apply to Entities which match a certain condition.

    Parameters

    • transformation: any

      An object of data or function to apply to all matched objects

    • condition: Function = null

      A function which tests whether to target each object

    • options: any = {}

    Returns Promise<Document[]>

    An array of updated data once the operation is complete

  • _preCreateDocuments(result: any[], options: any, userId: string): void
  • Preliminary actions taken before a set of Documents in this Collection are created.

    internal

    Parameters

    • result: any[]

      An Array of created data objects

    • options: any

      Options which modified the creation operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _onCreateDocuments(documents: Document[], result: any[], options: any, userId: string): void
  • Follow-up actions taken after a set of Documents in this Collection are created.

    internal

    Parameters

    • documents: Document[]

      An Array of created Documents

    • result: any[]

      An Array of created data objects

    • options: any

      Options which modified the creation operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _preUpdateDocuments(result: any[], options: any, userId: string): void
  • Preliminary actions taken before a set of Documents in this Collection are updated.

    internal

    Parameters

    • result: any[]

      An Array of incremental data objects

    • options: any

      Options which modified the update operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _onUpdateDocuments(documents: Document[], result: any[], options: any, userId: string): void
  • Follow-up actions taken after a set of Documents in this Collection are updated.

    internal

    Parameters

    • documents: Document[]

      An Array of updated Documents

    • result: any[]

      An Array of incremental data objects

    • options: any

      Options which modified the update operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _preDeleteDocuments(result: string[], options: any, userId: string): void
  • Preliminary actions taken before a set of Documents in this Collection are deleted.

    internal

    Parameters

    • result: string[]

      An Array of document IDs being deleted

    • options: any

      Options which modified the deletion operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _onDeleteDocuments(documents: Document[], result: string[], options: any, userId: string): void
  • Follow-up actions taken after a set of Documents in this Collection are deleted.

    internal

    Parameters

    • documents: Document[]

      An Array of deleted Documents

    • result: string[]

      An Array of document IDs being deleted

    • options: any

      Options which modified the deletion operation

    • userId: string

      The ID of the User who triggered the operation

    Returns void

  • _onDeleteFolder(parentFolder: Folder, deleteFolderId: string, deleteContents: boolean): string[]
  • Handle shifting documents in a deleted folder to a new parent folder.

    internal

    Parameters

    • parentFolder: Folder

      The parent folder to which documents should be shifted

    • deleteFolderId: string

      The ID of the folder being deleted

    • deleteContents: boolean

      Whether to delete the contents of the folder

    Returns string[]

    An array of document IDs to deleted

  • Show the JournalEntry or JournalEntryPage to connected players. By default, the document will only be shown to players who have permission to observe it. If the force parameter is passed, the document will be shown to all players regardless of normal permission.

    throws

    If the user does not own the document they are trying to show.

    Parameters

    • doc: JournalEntry | JournalEntryPage

      The JournalEntry or JournalEntryPage to show.

    • [options]: { force: boolean; users: string[] } = {}

      Additional options to configure behaviour.

      • force: boolean
      • users: string[]

    Returns Promise<JournalEntry | JournalEntryPage>

    A Promise that resolves back to the shown document once the request is processed.

  • Share an image with connected players.

    Parameters

    • src: string

      The image URL to share.

    • [config]: ShareImageConfig = {}

      Image sharing configuration.

    Returns void

  • _activateSocketListeners(socket: Socket): void
  • Open Socket listeners which transact JournalEntry data

    Parameters

    • socket: Socket

      The open websocket

    Returns void

  • _showEntry(uuid: string, force?: boolean): Promise<void>
  • Handle a received request to show a JournalEntry or JournalEntryPage to the current client

    internal

    Parameters

    • uuid: string

      The UUID of the document to display for other players

    • force: boolean = false

    Returns Promise<void>

  • registerSheet(...args: any[]): void
  • Register a Document sheet class as a candidate which can be used to display Documents of a given type. See DocumentSheetConfig.registerSheet for details.

    static
    example

    Register a new ActorSheet subclass for use with certain Actor types.

    Actors.registerSheet("dnd5e", ActorSheet5eCharacter, { types: ["character], makeDefault: true });
    

    Parameters

    • Rest ...args: any[]

      Arguments forwarded to the DocumentSheetConfig.registerSheet method

    Returns void

  • unregisterSheet(...args: any[]): void
  • Unregister a Document sheet class, removing it from the list of available sheet Applications to use. See DocumentSheetConfig.unregisterSheet for detauls.

    static
    example

    Deregister the default ActorSheet subclass to replace it with others.

    Actors.unregisterSheet("core", ActorSheet);
    

    Parameters

    • Rest ...args: any[]

      Arguments forwarded to the DocumentSheetConfig.unregisterSheet method

    Returns void

  • getSearchableFields(documentName: string, documentSubtype?: string, isEmbedded?: boolean): Set<string>
  • Get the searchable fields for a given document or index, based on its data model

    Parameters

    • documentName: string

      The document type name

    • documentSubtype: string = ""
    • isEmbedded: boolean = false

    Returns Set<string>

    The dot-delimited property paths of searchable fields

Properties

apps: Application[]

An Array of application references which will be automatically updated when the collection content changes

invalidDocumentIds: Set<string> = ...

Record the set of document ids where the Document was not initialized because of invalid source data

documentName: string = "JournalEntry"
override