[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

(no description)

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

Defines 136 functions

  isNonNullObject()
  isSpecial()
  isReactElement()
  emptyTarget()
  cloneUnlessOtherwiseSpecified()
  defaultArrayMerge()
  getMergeFunction()
  getEnumerableOwnPropertySymbols()
  getKeys()
  propertyIsOnObject()
  propertyIsUnsafe()
  mergeObject()
  deepmerge()
  _typeof()
  _classCallCheck()
  _defineProperties()
  _createClass()
  getValuePair()
  EquivalentKeyMap()
  __webpack_require__()
  _typeof()
  _toPrimitive()
  _toPropertyKey()
  _defineProperty()
  ownKeys()
  _objectSpread2()
  formatProdErrorMessage()
  isPlainObject()
  miniKindOf()
  ctorName()
  isError()
  isDate()
  kindOf()
  createStore()
  ensureCanMutateNextListeners()
  getState()
  subscribe()
  dispatch()
  replaceReducer()
  observable()
  observeState()
  warning()
  getUnexpectedStateShapeWarningMessage()
  assertReducerShape()
  combineReducers()
  bindActionCreator()
  bindActionCreators()
  compose()
  applyMiddleware()
  combine_reducers_combineReducers()
  createRegistrySelector()
  createRegistryControl()
  isObject()
  controls_select()
  resolveSelect()
  dispatch()
  isPromise()
  createThunkMiddleware()
  selectorArgsToStateKey()
  arrayOf()
  isObjectLike()
  createCache()
  isShallowEqual()
  rememo()
  getCache()
  clear()
  callSelector()
  getResolutionState()
  getIsResolving()
  hasStartedResolution()
  hasFinishedResolution()
  hasResolutionFailed()
  getResolutionError()
  isResolving()
  getCachedResolvers()
  hasResolvingSelectors()
  startResolution()
  finishResolution()
  failResolution()
  startResolutions()
  finishResolutions()
  failResolutions()
  invalidateResolution()
  invalidateResolutionForStore()
  invalidateResolutionForStoreSelector()
  createResolversCache()
  createBindingCache()
  createReduxStore()
  bindAction()
  bindSelector()
  bindMetadataSelector()
  instantiateReduxStore()
  mapResolveSelectors()
  mapSuspendSelectors()
  mapResolvers()
  mapSelectorWithResolver()
  fulfillSelector()
  normalize()
  createEmitter()
  getStoreName()
  createRegistry()
  globalListener()
  select()
  __unstableMarkListeningStores()
  resolveSelect()
  suspendSelect()
  dispatch()
  withPlugins()
  registerStoreInstance()
  register()
  registerGenericStore()
  registerStore()
  batch()
  use()
  is_plain_object_isObject()
  is_plain_object_isPlainObject()
  createPersistenceInterface()
  getData()
  setData()
  persistencePlugin()
  createPersistOnChange()
  useRegistry()
  useAsyncMode()
  Store()
  getStoreState()
  subscribe()
  subscribeStore()
  updateStores()
  updateValue()
  getValue()
  useStaticSelect()
  useMappingSelect()
  useSelect()
  useSuspenseSelect()
  dispatch_dispatch()
  select_select()

Functions
Functions that are not part of a class:

isNonNullObject(value)   X-Ref
No description

isSpecial(value)   X-Ref
No description

isReactElement(value)   X-Ref
No description

emptyTarget(val)   X-Ref
No description

cloneUnlessOtherwiseSpecified(value, options)   X-Ref
No description

defaultArrayMerge(target, source, options)   X-Ref
No description

getMergeFunction(key, options)   X-Ref
No description

getEnumerableOwnPropertySymbols(target)   X-Ref
No description

getKeys(target)   X-Ref
No description

propertyIsOnObject(object, property)   X-Ref
No description

propertyIsUnsafe(target, key)   X-Ref
No description

mergeObject(target, source, options)   X-Ref
No description

deepmerge(target, source, options)   X-Ref
No description

_typeof(obj)   X-Ref
No description

_classCallCheck(instance, Constructor)   X-Ref
No description

_defineProperties(target, props)   X-Ref
No description

_createClass(Constructor, protoProps, staticProps)   X-Ref
No description

getValuePair(instance, key)   X-Ref
Given an instance of EquivalentKeyMap, returns its internal value pair tuple
for a key, if one exists. The tuple members consist of the last reference
value for the key (used in efficient subsequent lookups) and the value
assigned for the key at the leaf node.

param: {EquivalentKeyMap} instance EquivalentKeyMap instance.
param: {*} key                     The key for which to return value pair.
return: {?Array} Value pair, if exists.

EquivalentKeyMap(iterable)   X-Ref
No description

__webpack_require__(moduleId)   X-Ref
No description

_typeof(o)   X-Ref
No description

_toPrimitive(input, hint)   X-Ref
No description

_toPropertyKey(arg)   X-Ref
No description

_defineProperty(obj, key, value)   X-Ref
No description

ownKeys(e, r)   X-Ref
No description

_objectSpread2(e)   X-Ref
No description

formatProdErrorMessage(code)   X-Ref
Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js

Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
during build.
param: {number} code

isPlainObject(obj)   X-Ref

param: {any} obj The object to inspect.
returns: {boolean} True if the argument appears to be a plain object.

miniKindOf(val)   X-Ref
No description

ctorName(val)   X-Ref
No description

isError(val)   X-Ref
No description

isDate(val)   X-Ref
No description

kindOf(val)   X-Ref
No description

createStore(reducer, preloadedState, enhancer)   X-Ref


ensureCanMutateNextListeners()   X-Ref
This makes a shallow copy of currentListeners so we can use
nextListeners as a temporary list while dispatching.

This prevents any bugs around consumers calling
subscribe/unsubscribe in the middle of a dispatch.

getState()   X-Ref
Reads the state tree managed by the store.

returns: {any} The current state tree of your application.

subscribe(listener)   X-Ref
Adds a change listener. It will be called any time an action is dispatched,
and some part of the state tree may potentially have changed. You may then
call `getState()` to read the current state tree inside the callback.

You may call `dispatch()` from a change listener, with the following
caveats:

1. The subscriptions are snapshotted just before every `dispatch()` call.
If you subscribe or unsubscribe while the listeners are being invoked, this
will not have any effect on the `dispatch()` that is currently in progress.
However, the next `dispatch()` call, whether nested or not, will use a more
recent snapshot of the subscription list.

2. The listener should not expect to see all state changes, as the state
might have been updated multiple times during a nested `dispatch()` before
the listener is called. It is, however, guaranteed that all subscribers
registered before the `dispatch()` started will be called with the latest
state by the time it exits.

param: {Function} listener A callback to be invoked on every dispatch.
returns: {Function} A function to remove this change listener.

dispatch(action)   X-Ref
Dispatches an action. It is the only way to trigger a state change.

The `reducer` function, used to create the store, will be called with the
current state tree and the given `action`. Its return value will
be considered the **next** state of the tree, and the change listeners
will be notified.

The base implementation only supports plain object actions. If you want to
dispatch a Promise, an Observable, a thunk, or something else, you need to
wrap your store creating function into the corresponding middleware. For
example, see the documentation for the `redux-thunk` package. Even the
middleware will eventually dispatch plain object actions using this method.

param: {Object} action A plain object representing “what changed”. It is
returns: {Object} For convenience, the same action object you dispatched.

replaceReducer(nextReducer)   X-Ref
Replaces the reducer currently used by the store to calculate the state.

You might need this if your app implements code splitting and you want to
load some of the reducers dynamically. You might also need this if you
implement a hot reloading mechanism for Redux.

param: {Function} nextReducer The reducer for the store to use instead.
returns: {void}

observable()   X-Ref
Interoperability point for observable/reactive libraries.

returns: {observable} A minimal observable of state changes.

observeState()   X-Ref
No description

warning(message)   X-Ref
Prints a warning in the console if it exists.

param: {String} message The warning message.
returns: {void}

getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache)   X-Ref
No description

assertReducerShape(reducers)   X-Ref
No description

combineReducers(reducers)   X-Ref
Turns an object whose values are different reducer functions, into a single
reducer function. It will call every child reducer, and gather their results
into a single state object, whose keys correspond to the keys of the passed
reducer functions.

param: {Object} reducers An object whose values correspond to different
returns: {Function} A reducer function that invokes every reducer inside the

bindActionCreator(actionCreator, dispatch)   X-Ref
No description

bindActionCreators(actionCreators, dispatch)   X-Ref
Turns an object whose values are action creators, into an object with the
same keys, but with every function wrapped into a `dispatch` call so they
may be invoked directly. This is just a convenience method, as you can call
`store.dispatch(MyActionCreators.doSomething())` yourself just fine.

For convenience, you can also pass an action creator as the first argument,
and get a dispatch wrapped function in return.

param: {Function|Object} actionCreators An object whose values are action
param: {Function} dispatch The `dispatch` function available on your Redux
returns: {Function|Object} The object mimicking the original object, but with

compose()   X-Ref
Composes single-argument functions from right to left. The rightmost
function can take multiple arguments as it provides the signature for
the resulting composite function.

param: {...Function} funcs The functions to compose.
returns: {Function} A function obtained by composing the argument functions

applyMiddleware()   X-Ref
Creates a store enhancer that applies middleware to the dispatch method
of the Redux store. This is handy for a variety of tasks, such as expressing
asynchronous actions in a concise manner, or logging every action payload.

See `redux-thunk` package as an example of the Redux middleware.

Because middleware is potentially asynchronous, this should be the first
store enhancer in the composition chain.

Note that each middleware will be given the `dispatch` and `getState` functions
as named arguments.

param: {...Function} middlewares The middleware chain to be applied.
returns: {Function} A store enhancer applying the middleware.

combine_reducers_combineReducers(reducers)   X-Ref
No description

createRegistrySelector(registrySelector)   X-Ref
Creates a selector function that takes additional curried argument with the
registry `select` function. While a regular selector has signature
```js
( state, ...selectorArgs ) => ( result )
```
that allows to select data from the store's `state`, a registry selector
has signature:
```js
( select ) => ( state, ...selectorArgs ) => ( result )
```
that supports also selecting from other registered stores.

param: {Function} registrySelector Function receiving a registry `select`
return: {Function} Registry selector that can be registered with a store.

createRegistryControl(registryControl)   X-Ref
Creates a control function that takes additional curried argument with the `registry` object.
While a regular control has signature
```js
( action ) => ( iteratorOrPromise )
```
where the control works with the `action` that it's bound to, a registry control has signature:
```js
( registry ) => ( action ) => ( iteratorOrPromise )
```
A registry control is typically used to select data or dispatch an action to a registered
store.

When registering a control created with `createRegistryControl` with a store, the store
knows which calling convention to use when executing the control.

param: {Function} registryControl Function receiving a registry object and returning a control.
return: {Function} Registry control that can be registered with a store.

isObject(object)   X-Ref
No description

controls_select(storeNameOrDescriptor, selectorName, ...args)   X-Ref
Dispatches a control action for triggering a synchronous registry select.

Note: This control synchronously returns the current selector value, triggering the
resolution, but not waiting for it.

param: {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
param: {string}                 selectorName          The name of the selector.
param: {Array}                  args                  Arguments for the selector.
return: {Object} The control descriptor.

resolveSelect(storeNameOrDescriptor, selectorName, ...args)   X-Ref
Dispatches a control action for triggering and resolving a registry select.

Note: when this control action is handled, it automatically considers
selectors that may have a resolver. In such case, it will return a `Promise` that resolves
after the selector finishes resolving, with the final result value.

param: {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
param: {string}                 selectorName          The name of the selector
param: {Array}                  args                  Arguments for the selector.
return: {Object} The control descriptor.

dispatch(storeNameOrDescriptor, actionName, ...args)   X-Ref
Dispatches a control action for triggering a registry dispatch.

param: {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
param: {string}                 actionName            The name of the action to dispatch
param: {Array}                  args                  Arguments for the dispatch action.
return: {Object}  The control descriptor.

isPromise(obj)   X-Ref
No description

createThunkMiddleware(args)   X-Ref
No description

selectorArgsToStateKey(args)   X-Ref
Normalize selector argument array by defaulting `undefined` value to an empty array
and removing trailing `undefined` values.

param: args Selector argument array
return: Normalized state key array

arrayOf(value)   X-Ref
Returns the first argument as the sole entry in an array.

param: {T} value Value to return.
return: {[T]} Value returned as entry in array.

isObjectLike(value)   X-Ref
Returns true if the value passed is object-like, or false otherwise. A value
is object-like if it can support property assignment, e.g. object or array.

param: {*} value Value to test.
return: {boolean} Whether value is object-like.

createCache()   X-Ref
Creates and returns a new cache object.

return: {Cache} Cache object.

isShallowEqual(a, b, fromIndex)   X-Ref
Returns true if entries within the two arrays are strictly equal by
reference from a starting index.

param: {*[]} a First array.
param: {*[]} b Second array.
param: {number} fromIndex Index from which to start comparison.
return: {boolean} Whether arrays are shallowly equal.

rememo(selector, getDependants)   X-Ref
Returns a memoized selector function. The getDependants function argument is
called before the memoized selector and is expected to return an immutable
reference or array of references on which the selector depends for computing
its own return value. The memoize cache is preserved only as long as those
dependant references remain the same. If getDependants returns a different
reference(s), the cache is cleared and the selector value regenerated.

param: {S} selector Selector function.
param: {GetDependants=} getDependants Dependant getter returning an array of

getCache(dependants)   X-Ref
Returns the cache for a given dependants array. When possible, a WeakMap
will be used to create a unique cache for each set of dependants. This
is feasible due to the nature of WeakMap in allowing garbage collection
to occur on entries where the key object is no longer referenced. Since
WeakMap requires the key to be an object, this is only possible when the
dependant is object-like. The root cache is created as a hierarchy where
each top-level key is the first entry in a dependants set, the value a
WeakMap where each key is the next dependant, and so on. This continues
so long as the dependants are object-like. If no dependants are object-
like, then the cache is shared across all invocations.

param: {*[]} dependants Selector dependants.
return: {Cache} Cache object.

clear()   X-Ref
Resets root memoization cache.


callSelector()   X-Ref
The augmented selector call, considering first whether dependants have
changed before passing it to underlying memoize function.

param: {*}    source    Source object for derivation.
param: {...*} extraArgs Additional arguments to pass to selector.
return: {*} Selector result.

getResolutionState(state, selectorName, args)   X-Ref
Returns the raw resolution state value for a given selector name,
and arguments set. May be undefined if the selector has never been resolved
or not resolved for the given set of arguments, otherwise true or false for
resolution started and completed respectively.

param: {State}      state        Data state.
param: {string}     selectorName Selector name.
param: {unknown[]?} args         Arguments passed to selector.
return: {StateValue|undefined} isResolving value.

getIsResolving(state, selectorName, args)   X-Ref
Returns an `isResolving`-like value for a given selector name and arguments set.
Its value is either `undefined` if the selector has never been resolved or has been
invalidated, or a `true`/`false` boolean value if the resolution is in progress or
has finished, respectively.

This is a legacy selector that was implemented when the "raw" internal data had
this `undefined | boolean` format. Nowadays the internal value is an object that
can be retrieved with `getResolutionState`.

param: {State}      state        Data state.
param: {string}     selectorName Selector name.
param: {unknown[]?} args         Arguments passed to selector.
return: {boolean | undefined} isResolving value.

hasStartedResolution(state, selectorName, args)   X-Ref
Returns true if resolution has already been triggered for a given
selector name, and arguments set.

param: {State}      state        Data state.
param: {string}     selectorName Selector name.
param: {unknown[]?} args         Arguments passed to selector.
return: {boolean} Whether resolution has been triggered.

hasFinishedResolution(state, selectorName, args)   X-Ref
Returns true if resolution has completed for a given selector
name, and arguments set.

param: {State}      state        Data state.
param: {string}     selectorName Selector name.
param: {unknown[]?} args         Arguments passed to selector.
return: {boolean} Whether resolution has completed.

hasResolutionFailed(state, selectorName, args)   X-Ref
Returns true if resolution has failed for a given selector
name, and arguments set.

param: {State}      state        Data state.
param: {string}     selectorName Selector name.
param: {unknown[]?} args         Arguments passed to selector.
return: {boolean} Has resolution failed

getResolutionError(state, selectorName, args)   X-Ref
Returns the resolution error for a given selector name, and arguments set.
Note it may be of an Error type, but may also be null, undefined, or anything else
that can be `throw`-n.

param: {State}      state        Data state.
param: {string}     selectorName Selector name.
param: {unknown[]?} args         Arguments passed to selector.
return: {Error|unknown} Last resolution error

isResolving(state, selectorName, args)   X-Ref
Returns true if resolution has been triggered but has not yet completed for
a given selector name, and arguments set.

param: {State}      state        Data state.
param: {string}     selectorName Selector name.
param: {unknown[]?} args         Arguments passed to selector.
return: {boolean} Whether resolution is in progress.

getCachedResolvers(state)   X-Ref
Returns the list of the cached resolvers.

param: {State} state Data state.
return: {State} Resolvers mapped by args and selectorName.

hasResolvingSelectors(state)   X-Ref
Whether the store has any currently resolving selectors.

param: {State} state Data state.
return: {boolean} True if one or more selectors are resolving, false otherwise.

startResolution(selectorName, args)   X-Ref
Returns an action object used in signalling that selector resolution has
started.

param: {string}    selectorName Name of selector for which resolver triggered.
param: {unknown[]} args         Arguments to associate for uniqueness.
return: {{ type: 'START_RESOLUTION', selectorName: string, args: unknown[] }} Action object.

finishResolution(selectorName, args)   X-Ref
Returns an action object used in signalling that selector resolution has
completed.

param: {string}    selectorName Name of selector for which resolver triggered.
param: {unknown[]} args         Arguments to associate for uniqueness.
return: {{ type: 'FINISH_RESOLUTION', selectorName: string, args: unknown[] }} Action object.

failResolution(selectorName, args, error)   X-Ref
Returns an action object used in signalling that selector resolution has
failed.

param: {string}        selectorName Name of selector for which resolver triggered.
param: {unknown[]}     args         Arguments to associate for uniqueness.
param: {Error|unknown} error        The error that caused the failure.
return: {{ type: 'FAIL_RESOLUTION', selectorName: string, args: unknown[], error: Error|unknown }} Action object.

startResolutions(selectorName, args)   X-Ref
Returns an action object used in signalling that a batch of selector resolutions has
started.

param: {string}      selectorName Name of selector for which resolver triggered.
param: {unknown[][]} args         Array of arguments to associate for uniqueness, each item
return: {{ type: 'START_RESOLUTIONS', selectorName: string, args: unknown[][] }} Action object.

finishResolutions(selectorName, args)   X-Ref
Returns an action object used in signalling that a batch of selector resolutions has
completed.

param: {string}      selectorName Name of selector for which resolver triggered.
param: {unknown[][]} args         Array of arguments to associate for uniqueness, each item
return: {{ type: 'FINISH_RESOLUTIONS', selectorName: string, args: unknown[][] }} Action object.

failResolutions(selectorName, args, errors)   X-Ref
Returns an action object used in signalling that a batch of selector resolutions has
completed and at least one of them has failed.

param: {string}            selectorName Name of selector for which resolver triggered.
param: {unknown[]}         args         Array of arguments to associate for uniqueness, each item
param: {(Error|unknown)[]} errors       Array of errors to associate for uniqueness, each item
return: {{ type: 'FAIL_RESOLUTIONS', selectorName: string, args: unknown[], errors: Array<Error|unknown> }} Action object.

invalidateResolution(selectorName, args)   X-Ref
Returns an action object used in signalling that we should invalidate the resolution cache.

param: {string}    selectorName Name of selector for which resolver should be invalidated.
param: {unknown[]} args         Arguments to associate for uniqueness.
return: {{ type: 'INVALIDATE_RESOLUTION', selectorName: string, args: any[] }} Action object.

invalidateResolutionForStore()   X-Ref
Returns an action object used in signalling that the resolution
should be invalidated.

return: {{ type: 'INVALIDATE_RESOLUTION_FOR_STORE' }} Action object.

invalidateResolutionForStoreSelector(selectorName)   X-Ref
Returns an action object used in signalling that the resolution cache for a
given selectorName should be invalidated.

param: {string} selectorName Name of selector for which all resolvers should
return: {{ type: 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR', selectorName: string }} Action object.

createResolversCache()   X-Ref
Create a cache to track whether resolvers started running or not.

return: {Object} Resolvers Cache.

createBindingCache(bind)   X-Ref
No description

createReduxStore(key, options)   X-Ref
Creates a data store descriptor for the provided Redux store configuration containing
properties describing reducer, actions, selectors, controls and resolvers.

param: {string}                                    key     Unique namespace identifier.
param: {ReduxStoreConfig<State,Actions,Selectors>} options Registered store options, with properties
return: {StoreDescriptor<ReduxStoreConfig<State,Actions,Selectors>>} Store Object.

bindAction(action)   X-Ref
No description

bindSelector(selector, selectorName)   X-Ref
No description

bindMetadataSelector(metaDataSelector)   X-Ref
No description

instantiateReduxStore(key, options, registry, thunkArgs)   X-Ref
Creates a redux store for a namespace.

param: {string}       key       Unique namespace identifier.
param: {Object}       options   Registered store options, with properties
param: {DataRegistry} registry  Registry reference.
param: {Object}       thunkArgs Argument object for the thunk middleware.
return: {Object} Newly created redux store.

mapResolveSelectors(selectors, store)   X-Ref
Maps selectors to functions that return a resolution promise for them

param: {Object} selectors Selectors to map.
param: {Object} store     The redux store the selectors select from.
return: {Object} Selectors mapped to their resolution functions.

mapSuspendSelectors(selectors, store)   X-Ref
Maps selectors to functions that throw a suspense promise if not yet resolved.

param: {Object} selectors Selectors to map.
param: {Object} store     The redux store the selectors select from.
return: {Object} Selectors mapped to their suspense functions.

mapResolvers(resolvers)   X-Ref
Convert resolvers to a normalized form, an object with `fulfill` method and
optional methods like `isFulfilled`.

param: {Object} resolvers Resolver to convert

mapSelectorWithResolver(selector, selectorName, resolver, store, resolversCache)   X-Ref
Returns a selector with a matched resolver.
Resolvers are side effects invoked once per argument set of a given selector call,
used in ensuring that the data needs for the selector are satisfied.

param: {Object} selector       The selector function to be bound.
param: {string} selectorName   The selector name.
param: {Object} resolver       Resolver to call.
param: {Object} store          The redux store to which the resolvers should be mapped.
param: {Object} resolversCache Resolvers Cache.

fulfillSelector(args)   X-Ref
No description

normalize(selector, args)   X-Ref
Applies selector's normalization function to the given arguments
if it exists.

param: {Object} selector The selector potentially with a normalization method property.
param: {Array}  args     selector arguments to normalize.
return: {Array} Potentially normalized arguments.

createEmitter()   X-Ref
Create an event emitter.

return: {import("../types").DataEmitter} Emitter.

getStoreName(storeNameOrDescriptor)   X-Ref


createRegistry(storeConfigs = {}, parent = null)   X-Ref
Creates a new store registry, given an optional object of initial store
configurations.

param: {Object}  storeConfigs Initial store configurations.
param: {Object?} parent       Parent registry.
return: {WPDataRegistry} Data registry.

globalListener()   X-Ref
Global listener called for each store's update.


select(storeNameOrDescriptor)   X-Ref
Calls a selector given the current state and extra arguments.

param: {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
return: {*} The selector's returned value.

__unstableMarkListeningStores(callback, ref)   X-Ref
No description

resolveSelect(storeNameOrDescriptor)   X-Ref
Given a store descriptor, returns an object containing the store's selectors pre-bound to
state so that you only need to supply additional arguments, and modified so that they return
promises that resolve to their eventual values, after any resolvers have ran.

param: {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling
return: {Object} Each key of the object matches the name of a selector.

suspendSelect(storeNameOrDescriptor)   X-Ref
Given a store descriptor, returns an object containing the store's selectors pre-bound to
state so that you only need to supply additional arguments, and modified so that they throw
promises in case the selector is not resolved yet.

param: {StoreDescriptor|string} storeNameOrDescriptor The store descriptor. The legacy calling
return: {Object} Object containing the store's suspense-wrapped selectors.

dispatch(storeNameOrDescriptor)   X-Ref
Returns the available actions for a part of the state.

param: {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store
return: {*} The action's returned value.

withPlugins(attributes)   X-Ref
No description

registerStoreInstance(name, createStore)   X-Ref
Registers a store instance.

param: {string}   name        Store registry name.
param: {Function} createStore Function that creates a store object (getSelectors, getActions, subscribe).

register(store)   X-Ref
Registers a new store given a store descriptor.

param: {StoreDescriptor} store Store descriptor.

registerGenericStore(name, store)   X-Ref
No description

registerStore(storeName, options)   X-Ref
Registers a standard `@wordpress/data` store.

param: {string} storeName Unique namespace identifier.
param: {Object} options   Store description (reducer, actions, selectors, resolvers).
return: {Object} Registered store object.

batch(callback)   X-Ref
No description

use(plugin, options)   X-Ref
No description

is_plain_object_isObject(o)   X-Ref
No description

is_plain_object_isPlainObject(o)   X-Ref
No description

createPersistenceInterface(options)   X-Ref
Creates a persistence interface, exposing getter and setter methods (`get`
and `set` respectively).

param: {WPDataPersistencePluginOptions} options Plugin options.
return: {Object} Persistence interface.

getData()   X-Ref
Returns the persisted data as an object, defaulting to an empty object.

return: {Object} Persisted data.

setData(key, value)   X-Ref
Merges an updated reducer state into the persisted data.

param: {string} key   Key to update.
param: {*}      value Updated value.

persistencePlugin(registry, pluginOptions)   X-Ref
Data plugin to persist store state into a single storage key.

param: {WPDataRegistry}                  registry      Data registry.
param: {?WPDataPersistencePluginOptions} pluginOptions Plugin options.
return: {WPDataPlugin} Data plugin.

createPersistOnChange(getState, storeName, keys)   X-Ref
Creates an enhanced store dispatch function, triggering the state of the
given store name to be persisted when changed.

param: {Function}       getState  Function which returns current state.
param: {string}         storeName Store name.
param: {?Array<string>} keys      Optional subset of keys to save.
return: {Function} Enhanced dispatch function.

useRegistry()   X-Ref
A custom react hook exposing the registry context for use.

This exposes the `registry` value provided via the
<a href="#RegistryProvider">Registry Provider</a> to a component implementing
this hook.

It acts similarly to the `useContext` react hook.

Note: Generally speaking, `useRegistry` is a low level hook that in most cases
won't be needed for implementation. Most interactions with the `@wordpress/data`
API can be performed via the `useSelect` hook,  or the `withSelect` and
`withDispatch` higher order components.

return: {Function}  A custom react hook exposing the registry context value.

useAsyncMode()   X-Ref
Internal dependencies


Store(registry, suspense)   X-Ref


getStoreState(name)   X-Ref
No description

subscribe(listener)   X-Ref
No description

subscribeStore(storeName)   X-Ref
No description

updateStores(newStores)   X-Ref
No description

updateValue()   X-Ref
No description

getValue()   X-Ref
No description

useStaticSelect(storeName)   X-Ref
No description

useMappingSelect(suspense, mapSelect, deps)   X-Ref
No description

useSelect(mapSelect, deps)   X-Ref
Custom react hook for retrieving props from registered selectors.

In general, this custom React hook follows the
[rules of hooks](https://react.dev/reference/rules/rules-of-hooks).

param: {T}         mapSelect Function called on every state change. The returned value is
param: {unknown[]} deps      If provided, this memoizes the mapSelect so the same `mapSelect` is
return: {UseSelectReturn<T>} A custom react hook.

useSuspenseSelect(mapSelect, deps)   X-Ref
A variant of the `useSelect` hook that has the same API, but is a compatible
Suspense-enabled data source.

param: {T}     mapSelect Function called on every state change. The
param: {Array} deps      A dependency array used to memoize the `mapSelect`
return: {ReturnType<T>} Data object returned by the `mapSelect` function.

dispatch_dispatch(storeNameOrDescriptor)   X-Ref
Given a store descriptor, returns an object of the store's action creators.
Calling an action creator will cause it to be dispatched, updating the state value accordingly.

Note: Action creators returned by the dispatch will return a promise when
they are called.

param: storeNameOrDescriptor The store descriptor. The legacy calling convention of passing
return: Object containing the action creators.

select_select(storeNameOrDescriptor)   X-Ref
Given a store descriptor, returns an object of the store's selectors.
The selector functions are been pre-bound to pass the current state automatically.
As a consumer, you need only pass arguments of the selector, if applicable.

param: storeNameOrDescriptor The store descriptor. The legacy calling convention
return: Object containing the store's selectors.



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