@wordpress/blocks
Version:
Block API for WordPress.
54 lines (43 loc) • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCategories = getCategories;
exports.setCategories = setCategories;
exports.updateCategory = updateCategory;
var _data = require("@wordpress/data");
var _store = require("../store");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('../store/reducer').WPBlockCategory} WPBlockCategory */
/**
* Returns all the block categories.
*
* @return {WPBlockCategory[]} Block categories.
*/
function getCategories() {
return (0, _data.select)(_store.store).getCategories();
}
/**
* Sets the block categories.
*
* @param {WPBlockCategory[]} categories Block categories.
*/
function setCategories(categories) {
(0, _data.dispatch)(_store.store).setCategories(categories);
}
/**
* Updates a category.
*
* @param {string} slug Block category slug.
* @param {WPBlockCategory} category Object containing the category properties
* that should be updated.
*/
function updateCategory(slug, category) {
(0, _data.dispatch)(_store.store).updateCategory(slug, category);
}
//# sourceMappingURL=categories.js.map