MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / leftReleased

Method leftReleased

contributed/modClock/main.js:1163–1233  ·  view source on GitHub ↗
(button)

Source from the content-addressed store, hash-verified

1161 }
1162
1163 leftReleased(button) {
1164 let d = new Date();
1165trace(`leftReleased - clear needsReboot, now: ${Time.ticks} elapsed: ${button.elapsed}\n`);
1166 global.needsReboot = 0;
1167 if (this.clock.uiState === STATE_CYCLE_MODE) {
1168trace(`uiState: CYCLE_MODE - uiMode: ${this.clock.uiMode}\n`);
1169 switch (this.clock.uiMode) {
1170 case MODE_SET:
1171 this.clock.uiState = STATE_SET_HOURS;
1172
1173 this.clock.drawHours(d);
1174 this.clock.confirm = 0;
1175 break;
1176 case MODE_2412: this.clock.uiState = STATE_SET_2412; break;
1177 case MODE_DST: this.clock.uiState = STATE_SET_DST; break;
1178 case MODE_BRIGHT: this.clock.uiState = STATE_SET_BRIGHT; break;
1179 case MODE_TAIL: this.clock.uiState = STATE_SET_TAIL; break;
1180 case MODE_TAIL_BRIGHT: this.clock.uiState = STATE_SET_TAIL_BRIGHT; break;
1181 case MODE_BOOT:
1182 this.clock.confirm = 0;
1183 this.clock.uiState = STATE_BOOT_CONFIRM;
1184 break;
1185 case MODE_CLEAR:
1186 this.clock.confirm = 0;
1187 this.clock.uiState = STATE_CLEAR_CONFIRM;
1188 break;
1189 }
1190trace(`uiState: set to ${this.clock.uiState}\n`);
1191 }
1192 else if ((this.clock.uiState === STATE_CLEAR_CONFIRM) || (this.clock.uiState === STATE_BOOT_CONFIRM)) {
1193 if (this.clock.confirm) {
1194 if (this.clock.uiState === STATE_CLEAR_CONFIRM)
1195 this.clock.prefs.reset();
1196 doRestart(this.clock);
1197 }
1198 this.clock.uiState = STATE_SHOW_TIME;
1199 this.clock.display.showTime(this.clock.currentStyle);
1200 }
1201 else if (this.clock.uiState === STATE_SET_HOURS) {
1202 this.clock.uiState = STATE_SET_10MINUTES;
1203 this.clock.draw10Min(d);
1204 }
1205 else if (this.clock.uiState === STATE_SET_10MINUTES) {
1206 this.clock.uiState = STATE_SET_MINUTES;
1207 this.clock.drawMin(d);
1208 }
1209 else if (this.clock.uiState === STATE_SET_MINUTES) {
1210 this.clock.uiState = STATE_SET_DONE;
1211 this.clock.display.value("done");
1212 }
1213 else if (this.clock.uiState === STATE_SET_DONE) {
1214 if (this.clock.confirm) {
1215 this.clock.uiState = STATE_SHOW_TIME;
1216 this.clock.display.showTime(this.clock.currentStyle);
1217 }
1218 else {
1219 this.clock.uiState = STATE_SET_HOURS;
1220 this.clock.drawHours(d);

Callers

nothing calls this directly

Calls 7

drawHoursMethod · 0.80
showTimeMethod · 0.80
draw10MinMethod · 0.80
drawMinMethod · 0.80
doRestartFunction · 0.70
resetMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected