Skip to content

@vttforge/core / ModuleRegistration

Interface: ModuleRegistration

Properties

actorDataModels?

readonly optional actorDataModels?: Readonly<Record<string, unknown>>

Actor sub-types this module contributes, keyed by the bare type name. Registered under <id>.<type>, so declare them the same way in documentTypes.Actor in your manifest.


enrichers?

readonly optional enrichers?: readonly EnricherRegistration[]

Text enrichers this module contributes, registered under <id>.<enricher id>.

Register them here rather than pushing to CONFIG.TextEditor.enrichers yourself: that array has four ways to accept an entry and then do nothing with it. See registerEnrichers.


id

readonly id: string

Module id: must match the folder name and module.json id.


itemDataModels?

readonly optional itemDataModels?: Readonly<Record<string, unknown>>

Item sub-types, same rule as actorDataModels.


onAfterInit?

readonly optional onAfterInit?: () => void

Runs after the mutations above, inside the same init hook.

Returns

void


onBeforeInit?

readonly optional onBeforeInit?: () => void

Runs before any CONFIG mutation: the usual home for the module API.

Returns

void


onI18nInit?

readonly optional onI18nInit?: () => void

Runs on i18nInit, after Foundry loads the language files.

This is where CONFIG labels get translated. game.i18n is not loaded during init, so game.i18n.localize() called there returns the key you passed it, and the untranslated key is what players see.

Returns

void


onReady?

readonly optional onReady?: () => void | Promise<void>

Runs once on ready.

Not GM-gated. Guard inside your callback when the work is GM-only.

Returns

void | Promise<void>


onSetup?

readonly optional onSetup?: () => void | Promise<void>

Runs on setup, after every package is loaded and before the canvas is drawn.

For a module this is also the first point where the system it is extending has finished its own init, so it is the place to read what the system registered. A setting registered during init can only be read from here on. Keep world data out of it, that is onReady.

Returns

void | Promise<void>


sheets?

readonly optional sheets?: readonly SheetRegistration[]

Sheets this module offers, registered under <id>.<sheet id>.

Register them here rather than calling Foundry's registerSheet yourself: Foundry derives the persisted key from the class name, and a bundler renames classes between builds. See registerSheets.


statusEffects?

readonly optional statusEffects?: readonly StatusEffectConfig[]

Conditions this module adds to CONFIG.statusEffects, each keyed by its id. Prefix the id with the module id (my-module.dazed) so it cannot collide with the system's own. Added one by one, never assigned: the collection belongs to the system, and replacing it would delete the conditions the world depends on.

MIT licensed.