[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

(no description)

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

Defines 15 functions

  signals_core_module_i()
  store()
  createFlusher()
  utils_useSignalEffect()
  useWatch()
  useInit()
  useEffect()
  useLayoutEffect()
  useCallback()
  useMemo()
  insert()
  kebabToCamelCase()
  toVdom()
  walk()
  yieldToMain()

Functions
Functions that are not part of a class:

signals_core_module_i()   X-Ref
No description

store(namespace, {state = {},...block} = {}, {lock = false} = {})   X-Ref
Extends the Interactivity API global store adding the passed properties to
the given namespace. It also returns stable references to the namespace
content.

These props typically consist of `state`, which is the reactive part of the
store ― which means that any directive referencing a state property will be
re-rendered anytime it changes ― and function properties like `actions` and
`callbacks`, mostly used for event handlers. These props can then be
referenced by any directive to make the HTML interactive.

return: A reference to the namespace content.
param: namespace The store namespace to interact with.
param: storePart Properties to add to the store namespace.
param: options   Options for the given namespace.

createFlusher(compute, notify)   X-Ref
No description

utils_useSignalEffect(callback)   X-Ref
No description

useWatch(callback)   X-Ref
Accepts a function that contains imperative code which runs whenever any of
the accessed _reactive_ properties (e.g., values from the global state or the
context) is modified.

This hook makes the element's scope available so functions like
`getElement()` and `getContext()` can be used inside the passed callback.

param: {Function} callback The hook callback.

useInit(callback)   X-Ref
Accepts a function that contains imperative code which runs only after the
element's first render, mainly useful for intialization logic.

This hook makes the element's scope available so functions like
`getElement()` and `getContext()` can be used inside the passed callback.

param: {Function} callback The hook callback.

useEffect(callback, inputs)   X-Ref
Accepts a function that contains imperative, possibly effectful code. The
effects run after browser paint, without blocking it.

This hook is equivalent to Preact's `useEffect` and makes the element's scope
available so functions like `getElement()` and `getContext()` can be used
inside the passed callback.

param: {Function} callback Imperative function that can return a cleanup
param: {any[]}    inputs   If present, effect will only activate if the

useLayoutEffect(callback, inputs)   X-Ref
Accepts a function that contains imperative, possibly effectful code. Use
this to read layout from the DOM and synchronously re-render.

This hook is equivalent to Preact's `useLayoutEffect` and makes the element's
scope available so functions like `getElement()` and `getContext()` can be
used inside the passed callback.

param: {Function} callback Imperative function that can return a cleanup
param: {any[]}    inputs   If present, effect will only activate if the

useCallback(callback, inputs)   X-Ref
Returns a memoized version of the callback that only changes if one of the
inputs has changed (using `===`).

This hook is equivalent to Preact's `useCallback` and makes the element's
scope available so functions like `getElement()` and `getContext()` can be
used inside the passed callback.

param: {Function} callback Imperative function that can return a cleanup
param: {any[]}    inputs   If present, effect will only activate if the

useMemo(factory, inputs)   X-Ref
Pass a factory function and an array of inputs. `useMemo` will only recompute
the memoized value when one of the inputs has changed.

This hook is equivalent to Preact's `useMemo` and makes the element's scope
available so functions like `getElement()` and `getContext()` can be used
inside the passed factory function.

param: {Function} factory Imperative function that can return a cleanup
param: {any[]}    inputs  If present, effect will only activate if the

insert(c, r)   X-Ref
No description

kebabToCamelCase(str)   X-Ref
Transforms a kebab-case string to camelCase.

return: {string} The transformed camelCase string.
param: {string} str The kebab-case string to transform to camelCase.

toVdom(root)   X-Ref
Recursive function that transforms a DOM tree into vDOM.

return: {import('preact').VNode[]} The resulting vDOM tree.
param: {Node} root The root element or node to start traversing on.

walk(node)   X-Ref
No description

yieldToMain()   X-Ref
No description



Generated : Sat Apr 27 08:20:02 2024 Cross-referenced by PHPXref