globalBeforeChangeHook
globalBeforeChangeHook<
TGlobalSlug,TDataModel>(slug,fn): (<TDataModel>(props) =>DocumentByGlobalSlug<TGlobalSlug> |Promise<DocumentByGlobalSlug<TGlobalSlug>>) |undefined
Defined in: packages/core/src/globals/hooks.ts:70
Types a global’s beforeChange hook against a real global and
DataModel. Mirrors beforeChangeHook (collections/hooks.ts).
Type Parameters
Section titled “Type Parameters”TGlobalSlug
Section titled “TGlobalSlug”TGlobalSlug extends string
TDataModel
Section titled “TDataModel”TDataModel extends GenericDataModel = GenericDataModel
Parameters
Section titled “Parameters”TGlobalSlug
The global slug constant (e.g. GLOBAL_SLUG_SITE_SETTINGS).
(props) => DocumentByGlobalSlug<TGlobalSlug> | Promise<DocumentByGlobalSlug<TGlobalSlug>>
The hook function, checked against the real types.
Returns
Section titled “Returns”(<TDataModel>(props) => DocumentByGlobalSlug<TGlobalSlug> | Promise<DocumentByGlobalSlug<TGlobalSlug>>) | undefined
The same function, re-typed to the global’s hooks.beforeChange signature.