MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / pop

Function pop

src/lib/actionStack.js:62–101  ·  view source on GitHub ↗

* Pop action from stack * @param {number} repeat pop action multiple times * @returns

(repeat)

Source from the content-addressed store, hash-verified

60 * @returns
61 */
62 async pop(repeat) {
63 if (freeze) return;
64 let confirmation = true;
65
66 if (typeof repeat === "number" && repeat > 1) {
67 for (let i = 0; i < repeat; ++i) {
68 this.pop();
69 }
70 return;
71 }
72
73 const fun = stack.pop();
74
75 if (fun) {
76 fun.action();
77 return;
78 }
79
80 if (appSettings.value.confirmOnExit) {
81 let closeMessage =
82 acode.exitAppMessage || strings["close app"].capitalize(0);
83 confirmation = await confirm(strings.warning.toUpperCase(), closeMessage);
84 }
85
86 if (confirmation) {
87 const { exitApp } = navigator.app;
88
89 if (typeof onCloseAppCallback === "function") {
90 const res = onCloseAppCallback();
91 if (res instanceof Promise) {
92 res.finally(exitApp);
93 return;
94 }
95 }
96
97 helpers.showInterstitialIfReady();
98
99 exitApp();
100 }
101 },
102 get(id) {
103 return stack.find((act) => act.id === id);
104 },

Callers

nothing calls this directly

Calls 2

confirmFunction · 0.85
capitalizeMethod · 0.80

Tested by

no test coverage detected