@vttforge/types / DocumentLifecycleHooks
Type Alias: DocumentLifecycleHooks ​
DocumentLifecycleHooks =
{ [K in DocumentHookName as `create${K}`]: [DocumentTypeMap[K], DatabaseOperationOptions, string] }&{ [K in DocumentHookName as `preCreate${K}`]: [DocumentTypeMap[K], Record<string, unknown>, DatabaseOperationOptions, string] }&{ [K in DocumentHookName as `update${K}`]: [DocumentTypeMap[K], Record<string, unknown>, DatabaseOperationOptions, string] }&{ [K in DocumentHookName as `preUpdate${K}`]: [DocumentTypeMap[K], Record<string, unknown>, DatabaseOperationOptions, string] }&{ [K in DocumentHookName as `delete${K}`]: [DocumentTypeMap[K], DatabaseOperationOptions, string] }&{ [K in DocumentHookName as `preDelete${K}`]: [DocumentTypeMap[K], DatabaseOperationOptions, string] }
The document lifecycle hooks.
A pre hook may return false to cancel the write. The rest run after it lands, on every connected client: guard a side effect with if (game.userId !== userId) return;.