Set default title for showPrompt

master
nlisgo 2021-11-25 11:40:37 +00:00
parent 9940b38bbd
commit 2b7091bd6b
1 changed files with 8 additions and 6 deletions

View File

@ -58,19 +58,16 @@ const getRandomInt = max => Math.floor(Math.random() * Math.floor(max)); // retu
const getRandomIntBetween = (min, max) => Math.floor(Math.random() * (max - min) + min);
const presentScramble = () => {
E.showPrompt(makeScramble().join(" "), {
title: "cube scramble",
showPrompt(makeScramble().join(" "), {
buttons: {"solve": true, "reset": false}
}).then((v) => {
if (v) {
const start = new Date();
E.showPrompt(" ", {
title: "cube scramble",
showPrompt(" ", {
buttons: {"stop": true}
}).then(() => {
const time = parseFloat(((new Date()).getTime() - start.getTime()) / 1000);
E.showPrompt(String(time.toFixed(3)), {
title: "cube scramble",
showPrompt(String(time.toFixed(3)), {
buttons: {"next": true}
}).then(() => {
presentScramble();
@ -82,6 +79,11 @@ const presentScramble = () => {
});
};
const showPrompt = (text, options = {}) => {
options.title = options.title || "cube scramble";
return E.showPrompt(text, options);
};
const init = () => {
Bangle.setLCDTimeout(0);
Bangle.setLCDPower(1);