[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

External dependencies

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

Defines 1 class

PropSignal:: (7 methods):
  store()
  isNonDefaultDirectiveSuffix()
  isDefaultDirectiveSuffix()
  deepClone()
  toVdom()
  walk()
  __webpack_require__()

Defines 7 functions

  createFlusher()
  utils_useSignalEffect()
  withScope()
  useWatch()
  useInit()
  useEffect()
  useLayoutEffect()
  useCallback()
  useMemo()
  insert()
  kebabToCamelCase()

Class: PropSignal  - X-Ref

Structure that manages reactivity for a property in a state object. It uses
signals to keep track of property value or getter modifications.

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.

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

isNonDefaultDirectiveSuffix(entry)   X-Ref
No description

isDefaultDirectiveSuffix(entry)   X-Ref
No description

deepClone(source)   X-Ref
Recursively clone the passed object.

param: source Source object.
return: Cloned object.

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

param: root The root element or node to start traversing on.
return: The resulting vDOM tree.

walk(node)   X-Ref
No description

__webpack_require__(moduleId)   X-Ref
No description

Functions
Functions that are not part of a class:

createFlusher(compute, notify)   X-Ref
Creates a Flusher object that can be used to flush computed values and notify listeners.

Using the mangled properties:
this.c: this._callback
this.x: this._compute
https://github.com/preactjs/signals/blob/main/mangle.json

param: compute The function that computes the value to be flushed.
param: notify  The function that notifies listeners when the value is flushed.
return: The Flusher object with `flush` and `dispose` properties.

utils_useSignalEffect(callback)   X-Ref
Custom hook that executes a callback function whenever a signal is triggered.
Version of `useSignalEffect` with a `useEffect`-like execution. This hook
implementation comes from this PR, but we added short-cirtuiting to avoid
infinite loops: https://github.com/preactjs/signals/pull/290

param: callback The callback function to be executed.

withScope(func)   X-Ref
Returns the passed function wrapped with the current scope so it is
accessible whenever the function runs. This is primarily to make the scope
available inside hook callbacks.

Asyncronous functions should use generators that yield promises instead of awaiting them.
See the documentation for details: https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/packages-interactivity-api-reference/#the-store

param: func The passed function.
return: The wrapped function.

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: 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: 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: callback Imperative function that can return a cleanup
param: 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: callback Imperative function that can return a cleanup
param: 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: callback Callback function.
param: inputs   If present, the callback will only be updated if the
return: The callback function.

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: factory Factory function that returns that value for memoization.
param: inputs  If present, the factory will only be run to recompute if
return: The memoized value.

insert(child, root)   X-Ref
No description

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

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



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref