[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> hooks.js (summary)

(no description)

File Size: 642 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

_Hooks:: (1 method):
  createHooks()

Defines 1 function

  validateNamespace()
  validateHookName()
  createAddHook()
  createRemoveHook()
  createHasHook()
  createRunHook()
  createCurrentHook()
  createDoingHook()
  createDidHook()

Class: _Hooks  - X-Ref

Internal class for constructing hooks. Use `createHooks()` function

Note, it is necessary to expose this class to make its type public.

createHooks()   X-Ref
Returns an instance of the hooks object.

return: {Hooks} A Hooks instance.

Functions
Functions that are not part of a class:

validateNamespace(namespace)   X-Ref
Validate a namespace string.

param: {string} namespace The namespace to validate - should take the form
return: {boolean} Whether the namespace is valid.

validateHookName(hookName)   X-Ref
Validate a hookName string.

param: {string} hookName The hook name to validate. Should be a non empty string containing
return: {boolean} Whether the hook name is valid.

createAddHook(hooks, storeKey)   X-Ref
Returns a function which, when invoked, will add a hook.

param: {import('.').Hooks}    hooks    Hooks instance.
param: {import('.').StoreKey} storeKey
return: {AddHook} Function that adds a new hook.

createRemoveHook(hooks, storeKey)   X-Ref
Returns a function which, when invoked, will remove a specified hook or all
hooks by the given name.

param: {import('.').Hooks}    hooks             Hooks instance.
param: {import('.').StoreKey} storeKey
param: {boolean}              [removeAll=false] Whether to remove all callbacks for a hookName,
return: {RemoveHook} Function that removes hooks.

createHasHook(hooks, storeKey)   X-Ref
Returns a function which, when invoked, will return whether any handlers are
attached to a particular hook.

param: {import('.').Hooks}    hooks    Hooks instance.
param: {import('.').StoreKey} storeKey
return: {HasHook} Function that returns whether any handlers are

createRunHook(hooks, storeKey)   X-Ref
Returns a function which, when invoked, will execute all callbacks
registered to a hook of the specified type, optionally returning the final
value of the call chain.

param: {import('.').Hooks}    hooks                  Hooks instance.
param: {import('.').StoreKey} storeKey
param: {boolean}              [returnFirstArg=false] Whether each hook callback is expected to
return: {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.

createCurrentHook(hooks, storeKey)   X-Ref
Returns a function which, when invoked, will return the name of the
currently running hook, or `null` if no hook of the given type is currently
running.

param: {import('.').Hooks}    hooks    Hooks instance.
param: {import('.').StoreKey} storeKey
return: {() => string | null} Function that returns the current hook name or null.

createDoingHook(hooks, storeKey)   X-Ref
Returns a function which, when invoked, will return whether a hook is
currently being executed.

param: {import('.').Hooks}    hooks    Hooks instance.
param: {import('.').StoreKey} storeKey
return: {DoingHook} Function that returns whether a hook is currently

createDidHook(hooks, storeKey)   X-Ref
Returns a function which, when invoked, will return the number of times a
hook has been called.

param: {import('.').Hooks}    hooks    Hooks instance.
param: {import('.').StoreKey} storeKey
return: {DidHook} Function that returns a hook's call count.



Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1