UNPKG

piral-core

Version:

The core library for creating a Piral instance.

26 lines 878 B
import { withoutKey, withKey, includeItem, excludeItem, replaceOrAddItem } from '../utils'; export function destroyPortal(ctx, id) { ctx.dispatch((state) => ({ ...state, portals: withoutKey(state.portals, id), })); } export function hidePortal(ctx, id, entry) { ctx.dispatch((state) => ({ ...state, portals: withKey(state.portals, id, excludeItem(state.portals[id], entry)), })); } export function updatePortal(ctx, id, current, next) { ctx.dispatch((state) => ({ ...state, portals: withKey(state.portals, id, replaceOrAddItem(state.portals[id], next, (m) => m === current)), })); } export function showPortal(ctx, id, entry) { ctx.dispatch((state) => ({ ...state, portals: withKey(state.portals, id, includeItem(state.portals[id], entry)), })); } //# sourceMappingURL=portal.js.map