UNPKG

@wordpress/data

Version:
35 lines (33 loc) 1.15 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.dispatch = dispatch; var _defaultRegistry = _interopRequireDefault(require("./default-registry")); /** * Internal dependencies */ /** * 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 * the store name is also supported. * * @example * ```js * import { dispatch } from '@wordpress/data'; * import { store as myCustomStore } from 'my-custom-store'; * * dispatch( myCustomStore ).setPrice( 'hammer', 9.75 ); * ``` * @return Object containing the action creators. */ function dispatch(storeNameOrDescriptor) { return _defaultRegistry.default.dispatch(storeNameOrDescriptor); } //# sourceMappingURL=dispatch.js.map