UNPKG

@shopify/app-bridge-core

Version:

**[Join our team and work on libraries like this one.](https://www.shopify.ca/careers)**

45 lines (42 loc) 1.07 kB
import { actionWrapper } from '../helper.js'; import { ActionSet } from '../ActionSet.js'; import { Group } from '../types.js'; var Action; (function (Action) { Action["START"] = "APP::LOADING::START"; Action["STOP"] = "APP::LOADING::STOP"; })(Action || (Action = {})); function start(payload) { return actionWrapper({ payload, group: Group.Loading, type: Action.START, }); } function stop(payload) { return actionWrapper({ payload, group: Group.Loading, type: Action.STOP, }); } class Loading extends ActionSet { constructor(app) { super(app, Group.Loading, Group.Loading); } get payload() { return { id: this.id }; } dispatch(action) { switch (action) { case Action.START: this.app.dispatch(start(this.payload)); break; case Action.STOP: this.app.dispatch(stop(this.payload)); break; } return this; } } export { Action, Loading, start, stop };