UNPKG

@wordpress/widget-dashboard

Version:

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

23 lines (22 loc) • 808 B
import { observableMap } from "@wordpress/compose"; // packages/widget-dashboard/src/utils/pending-actions-map.ts function createPendingActionsMap() { return 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); } export { createPendingActionsMap, setActionPending }; //# sourceMappingURL=pending-actions-map.mjs.map