MCPcopy Create free account
hub / github.com/Cu-chi/cuchi_computer / ShutdownComputer

Function ShutdownComputer

nui/scripts/script.js:1081–1107  ·  view source on GitHub ↗
(exitBtn, forced)

Source from the content-addressed store, hash-verified

1079 * @param {boolean} [forced] forced shutdown
1080 */
1081const ShutdownComputer = (exitBtn, forced) => {
1082 Load(true, forced ? GetLocale("os_shutdown_forced") : GetLocale("os_shuttingdown"), 1500, () => {
1083 document.body.style.display = "none";
1084 Load(false);
1085 fetch(`https://${GetParentResourceName()}/exit`,
1086 {
1087 method: "POST",
1088 body: null
1089 });
1090 });
1091 openedApps.forEach(appName => CloseApp(appName));
1092 openedApps = [];
1093
1094 if (exitBtn)
1095 exitBtn.removeAttribute("validation");
1096
1097 apps.forEach(app => {
1098 let appElement = document.getElementById("app-"+app);
1099 appElement.style.top = "25%";
1100 appElement.style.left = "25%";
1101
1102 let appTextElement = document.getElementById(app+"-text");
1103 if (appTextElement) {
1104 appTextElement.innerHTML = "";
1105 }
1106 });
1107}
1108
1109/**
1110 * Edit theme

Callers 2

script.jsFile · 0.85
commands.jsFile · 0.85

Calls 3

LoadFunction · 0.85
GetLocaleFunction · 0.85
CloseAppFunction · 0.85

Tested by

no test coverage detected