UNPKG

@wordpress/widget-dashboard

Version:

Stateless rendering engine for widget dashboards: the WidgetDashboard compound component and its grid-settings kit.

29 lines (28 loc) • 1.01 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); let _wordpress_compose = require("@wordpress/compose"); // packages/widget-dashboard/src/utils/pending-actions-map.ts function createPendingActionsMap() { return (0, _wordpress_compose.observableMap)(); } /** * Marks one action of an instance pending or settled. * * @param {PendingActionsMap} map The dashboard's map. * @param {string} uuid The instance. * @param {string} actionId The action. * @param {boolean} pending Whether its promise is still settling. */ function setActionPending(map, uuid, actionId, pending) { const next = new Set(map.get(uuid)); if (pending) next.add(actionId); else next.delete(actionId); if (next.size > 0) map.set(uuid, next); else map.delete(uuid); } exports.createPendingActionsMap = createPendingActionsMap; exports.setActionPending = setActionPending; //# sourceMappingURL=pending-actions-map.cjs.map