[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
(no description)
File Size: | 4619 lines (152 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
_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. return: {?Array} Value pair, if exists. param: {EquivalentKeyMap} instance EquivalentKeyMap instance. param: {*} key The key for which to return value pair. |
EquivalentKeyMap(iterable) X-Ref |
No description |
combineReducers( reducers ) X-Ref |
No description |
__webpack_require__(moduleId) X-Ref |
No description |
_defineProperty(obj, key, value) X-Ref |
No description |
ownKeys(object, enumerableOnly) X-Ref |
No description |
_objectSpread2(target) 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 |
returns: {boolean} True if the argument appears to be a plain object. param: {any} obj The object to inspect. |
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. returns: {Function} A function to remove this change listener. param: {Function} listener A callback to be invoked on every dispatch. |
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. returns: {Object} For convenience, the same action object you dispatched. param: {Object} action A plain object representing “what changed”. It is |
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. returns: {void} param: {Function} nextReducer The reducer for the store to use instead. |
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. returns: {void} param: {String} message The warning message. |
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. returns: {Function} A reducer function that invokes every reducer inside the param: {Object} reducers An object whose values correspond to different |
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. returns: {Function|Object} The object mimicking the original object, but with param: {Function|Object} actionCreators An object whose values are action param: {Function} dispatch The `dispatch` function available on your Redux |
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. returns: {Function} A function obtained by composing the argument functions param: {...Function} funcs The functions to compose. |
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. returns: {Function} A store enhancer applying the middleware. param: {...Function} middlewares The middleware chain to be applied. |
isCrushed() 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. return: {Function} Registry selector that can be registered with a store. param: {Function} registrySelector Function receiving a registry `select` |
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. return: {Function} Registry control that can be registered with a store. param: {Function} registryControl Function receiving a registry object and returning a control. |
controls_select(storeNameOrDescriptor, selectorName) 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. return: {Object} The control descriptor. 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. |
resolveSelect(storeNameOrDescriptor, selectorName) 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. return: {Object} The control descriptor. 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. |
dispatch(storeNameOrDescriptor, actionName) X-Ref |
Dispatches a control action for triggering a registry dispatch. return: {Object} The control descriptor. 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. |
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. return: Normalized state key array param: args Selector argument array |
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. return: {StateValue|undefined} isResolving value. param: {State} state Data state. param: {string} selectorName Selector name. param: {unknown[]?} args Arguments passed to selector. |
getIsResolving(state, selectorName, args) X-Ref |
Returns the raw `isResolving` 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. return: {boolean | undefined} isResolving value. param: {State} state Data state. param: {string} selectorName Selector name. param: {unknown[]?} args Arguments passed to selector. |
hasStartedResolution(state, selectorName, args) X-Ref |
Returns true if resolution has already been triggered for a given selector name, and arguments set. return: {boolean} Whether resolution has been triggered. param: {State} state Data state. param: {string} selectorName Selector name. param: {unknown[]?} args Arguments passed to selector. |
hasFinishedResolution(state, selectorName, args) X-Ref |
Returns true if resolution has completed for a given selector name, and arguments set. return: {boolean} Whether resolution has completed. param: {State} state Data state. param: {string} selectorName Selector name. param: {unknown[]?} args Arguments passed to selector. |
hasResolutionFailed(state, selectorName, args) X-Ref |
Returns true if resolution has failed for a given selector name, and arguments set. return: {boolean} Has resolution failed param: {State} state Data state. param: {string} selectorName Selector name. param: {unknown[]?} args Arguments passed to selector. |
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. return: {Error|unknown} Last resolution error param: {State} state Data state. param: {string} selectorName Selector name. param: {unknown[]?} args Arguments passed to selector. |
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. return: {boolean} Whether resolution is in progress. param: {State} state Data state. param: {string} selectorName Selector name. param: {unknown[]?} args Arguments passed to selector. |
getCachedResolvers(state) X-Ref |
Returns the list of the cached resolvers. return: {State} Resolvers mapped by args and selectorName. param: {State} state Data state. |
startResolution(selectorName, args) X-Ref |
Returns an action object used in signalling that selector resolution has started. return: {{ type: 'START_RESOLUTION', selectorName: string, args: unknown[] }} Action object. param: {string} selectorName Name of selector for which resolver triggered. param: {unknown[]} args Arguments to associate for uniqueness. |
finishResolution(selectorName, args) X-Ref |
Returns an action object used in signalling that selector resolution has completed. return: {{ type: 'FINISH_RESOLUTION', selectorName: string, args: unknown[] }} Action object. param: {string} selectorName Name of selector for which resolver triggered. param: {unknown[]} args Arguments to associate for uniqueness. |
failResolution(selectorName, args, error) X-Ref |
Returns an action object used in signalling that selector resolution has failed. return: {{ type: 'FAIL_RESOLUTION', selectorName: string, args: unknown[], error: Error|unknown }} Action object. 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. |
startResolutions(selectorName, args) X-Ref |
Returns an action object used in signalling that a batch of selector resolutions has started. return: {{ type: 'START_RESOLUTIONS', selectorName: string, args: unknown[][] }} Action object. param: {string} selectorName Name of selector for which resolver triggered. param: {unknown[][]} args Array of arguments to associate for uniqueness, each item |
finishResolutions(selectorName, args) X-Ref |
Returns an action object used in signalling that a batch of selector resolutions has completed. return: {{ type: 'FINISH_RESOLUTIONS', selectorName: string, args: unknown[][] }} Action object. param: {string} selectorName Name of selector for which resolver triggered. param: {unknown[][]} args Array of arguments to associate for uniqueness, each item |
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. return: {{ type: 'FAIL_RESOLUTIONS', selectorName: string, args: unknown[], errors: Array<Error|unknown> }} Action object. 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 |
invalidateResolution(selectorName, args) X-Ref |
Returns an action object used in signalling that we should invalidate the resolution cache. return: {{ type: 'INVALIDATE_RESOLUTION', selectorName: string, args: any[] }} Action object. param: {string} selectorName Name of selector for which resolver should be invalidated. param: {unknown[]} args Arguments to associate for uniqueness. |
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. return: {{ type: 'INVALIDATE_RESOLUTION_FOR_STORE_SELECTOR', selectorName: string }} Action object. param: {string} selectorName Name of selector for which all resolvers should |
createResolversCache() X-Ref |
Create a cache to track whether resolvers started running or not. return: {Object} Resolvers Cache. |
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. return: {StoreDescriptor} Store Object. param: {string} key Unique namespace identifier. param: {ReduxStoreConfig} options Registered store options, with properties |
instantiateReduxStore(key, options, registry, thunkArgs) X-Ref |
Creates a redux store for a namespace. return: {Object} Newly created redux store. 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. |
mapSelectors(selectors, store) X-Ref |
Maps selectors to a store. return: {Object} Selectors mapped to the provided store. param: {Object} selectors Selectors to register. Keys will be used as the param: {Object} store The store to which the selectors should be mapped. |
mapActions(actions, store) X-Ref |
Maps actions to dispatch from a given store. return: {Object} Actions mapped to the redux store provided. param: {Object} actions Actions to register. param: {Object} store The redux store to which the actions should be mapped. |
mapResolveSelectors(selectors, store) X-Ref |
Maps selectors to functions that return a resolution promise for them return: {Object} Selectors mapped to their resolution functions. param: {Object} selectors Selectors to map. param: {Object} store The redux store the selectors select from. |
mapResolvers(resolvers, selectors, store, resolversCache) X-Ref |
Returns resolvers with matched selectors for a given namespace. 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} resolvers Resolvers to register. param: {Object} selectors The current selectors to be modified. param: {Object} store The redux store to which the resolvers should be mapped. param: {Object} resolversCache Resolvers Cache. |
createEmitter() X-Ref |
Create an event emitter. return: {import("../types").DataEmitter} Emitter. |
createRegistry() X-Ref |
Creates a new store registry, given an optional object of initial store configurations. return: {WPDataRegistry} Data registry. param: {Object} storeConfigs Initial store configurations. param: {Object?} parent Parent 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. return: {*} The selector's returned value. param: {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store |
__unstableMarkListeningStores(callback, ref) X-Ref |
No description |
resolveSelect(storeNameOrDescriptor) X-Ref |
Given the name of a registered store, 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. return: {Object} Each key of the object matches the name of a selector. param: {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store |
dispatch(storeNameOrDescriptor) X-Ref |
Returns the available actions for a part of the state. return: {*} The action's returned value. param: {string|StoreDescriptor} storeNameOrDescriptor Unique namespace identifier for the store |
withPlugins(attributes) X-Ref |
No description |
registerStoreInstance(name, store) X-Ref |
Registers a store instance. param: {string} name Store registry name. param: {Object} store Store instance 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. return: {Object} Registered store object. param: {string} storeName Unique namespace identifier. param: {Object} options Store description (reducer, actions, selectors, resolvers). |
__unstableSubscribeStore(storeName, handler) X-Ref |
Subscribe handler to a store. return: {Function} A function to unsubscribe the handler. param: {string[]} storeName The store name. param: {Function} handler The function subscribed to the store. |
batch(callback) X-Ref |
No description |
use(plugin, options) X-Ref |
No description |
createPersistenceInterface(options) X-Ref |
Creates a persistence interface, exposing getter and setter methods (`get` and `set` respectively). return: {Object} Persistence interface. param: {WPDataPersistencePluginOptions} options Plugin options. |
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. return: {WPDataPlugin} Data plugin. param: {WPDataRegistry} registry Data registry. param: {?WPDataPersistencePluginOptions} pluginOptions Plugin options. |
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. return: {Function} Enhanced dispatch function. param: {Function} getState Function which returns current state. param: {string} storeName Store name. param: {?Array<string>} keys Optional subset of keys to save. |
migrateFeaturePreferencesToPreferencesStore(persistence, sourceStoreName) X-Ref |
Move the 'features' object in local storage from the sourceStoreName to the preferences store. param: {Object} persistence The persistence interface. param: {string} sourceStoreName The name of the store that has persisted |
migrateIndividualPreferenceToPreferencesStore(persistence, _ref, key) X-Ref |
Migrates an individual item inside the `preferences` object for a store. param: {Object} persistence The persistence interface. param: {Object} migrate An options object that contains details of the migration. param: {string} migrate.from The name of the store to migrate from. param: {string} migrate.scope The scope in the preferences store to migrate to. param: {string} key The key in the preferences object to migrate. param: {?Function} convert A function that converts preferences from one format to another. |
convertEditPostPanels(preferences) X-Ref |
Convert from: ``` { panels: { tags: { enabled: true, opened: true, }, permalinks: { enabled: false, opened: false, }, }, } ``` to: { inactivePanels: [ 'permalinks', ], openPanels: [ 'tags', ], } return: {Object} The converted data. param: {Object} preferences A preferences object. |
migrateThirdPartyFeaturePreferencesToPreferencesStore(persistence) X-Ref |
No description |
migrateInterfaceEnableItemsToPreferencesStore(persistence) X-Ref |
Migrates interface 'enableItems' data to the preferences store. The interface package stores this data in this format: ```js { enableItems: { singleEnableItems: { complementaryArea: { 'core/edit-post': 'edit-post/document', 'core/edit-site': 'edit-site/global-styles', } }, multipleEnableItems: { pinnedItems: { 'core/edit-post': { 'plugin-1': true, }, 'core/edit-site': { 'plugin-2': true, }, }, } } } ``` and it should be migrated it to: ```js { 'core/edit-post': { complementaryArea: 'edit-post/document', pinnedItems: { 'plugin-1': true, }, }, 'core/edit-site': { complementaryArea: 'edit-site/global-styles', pinnedItems: { 'plugin-2': true, }, }, } ``` param: {Object} persistence The persistence interface. |
_extends() X-Ref |
No description |
areInputsEqual(newInputs, lastInputs) X-Ref |
No description |
useMemoOne(getResult, inputs) X-Ref |
No description |
useCallbackOne(callback, inputs) X-Ref |
No description |
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 |
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://reactjs.org/docs/hooks-rules.html). return: {Function} A custom react hook. param: {Function|StoreDescriptor|string} mapSelect Function called on every state change. The param: {Array} deps If provided, this memoizes the mapSelect so the |
Generated: Thu Nov 21 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |