@shopify/app-bridge-core
Version:
**[Join our team and work on libraries like this one.](https://www.shopify.ca/careers)**
62 lines (59 loc) • 1.41 kB
JavaScript
import { actionWrapper } from '../helper.js';
import { ActionSet } from '../ActionSet.js';
import { Group } from '../types.js';
/**
* Fullscreen action type enum
* @remarks includes the action prefix and group
*
* @beta
*/
var Action;
(function (Action) {
Action["ENTER"] = "APP::FULLSCREEN::ENTER";
Action["EXIT"] = "APP::FULLSCREEN::EXIT";
})(Action || (Action = {}));
function enter() {
return actionWrapper({
group: Group.Fullscreen,
type: Action.ENTER,
});
}
function exit() {
return actionWrapper({
group: Group.Fullscreen,
type: Action.EXIT,
});
}
/**
* Fullscreen action set
* @beta
*/
class Fullscreen extends ActionSet {
/**
* Returns a new instance of a Fullscreen action set
* @param app the client application
*/
constructor(app) {
super(app, Group.Fullscreen, Group.Fullscreen);
}
/**
* Returns the action set payload
*/
get payload() {
return { id: this.id };
}
/**
* Dispatches a given action with the action set payload
* @param action the action enum
* @returns the action set instance
*/
dispatch(action) {
this.app.dispatch(actionWrapper({
group: this.group,
type: action,
payload: this.payload,
}));
return this;
}
}
export { Action, Fullscreen, enter, exit };