Compendium Packs

Compendium packs provide content creators and game-masters with an amazing way to store and organize their content. The following video provides an overview of the Compendium system and it’s basic usage.

Compendium API Usage

Module developers can interact with compendia in a programmatic way using the API offered by the Compendium() class.

class Compendium(metadata)

The client-side Compendium class

Arguments:
  • metadata (Object) – The compendium metadata, usually provided by game.data.packs
Compendium.close()

Customize Compendium closing behavior to toggle the sidebar folder status icon

Compendium.collection

The canonical Compendium name - comprised of the originating module and the pack name

Compendium.entity

type: String

The Entity type which is allowed to be stored in this collection

Compendium.getData()

Return the Compendium index as the data for rendering

Returns:Object – The data to render
Compendium.getEntity(entryId)

Get a single Compendium entry as an Entity instance

Arguments:
  • entryId (String) – The compendium entry ID to instantiate
Returns:

Promise – A Promise containing the returned Entity

Compendium.getEntry(entryId)

Get a single Compendium entry as an Object

Arguments:
  • entryId (String) – The compendium entry ID to retrieve
Returns:

Promise – A Promise containing the return entry data, or undefined

Compendium.getIndex()

Get the Compendium index Contains names and IDs of all data in the compendium

Returns:Promise – A Promise containing an index of all compendium entries
Compendium.importEntity(entity)

Import a new Entity into a Compendium pack

Arguments:
  • entity (Entity) – The Entity instance you wish to import
Compendium.index

type: Array

An index of data contained within this compendium. The index is empty until getIndex() is called.

Compendium.metadata

type: Object

The compendium metadata which defines the compendium content and location

Compendium.removeEntity(entryId)

Remove a single Compendium entry by its ID

Arguments:
  • entryId (String) – The compendium entry ID to remove
Compendium.render(force=false)

Override the default WindowApplication rendering logic to wrap the render call in a promise which retrieves the compendium data.

Arguments:
  • force (Boolean) – Render even if the app is not currently present in the DOM
Compendium.template

type: String

The Compendium template when displayed as a Window

Compendium.title

type: String

The Compendium title