Skip to content

Commit 32a97ff

Browse files
js: fix gui widget demo
1 parent 56b5cb1 commit 32a97ff

File tree

1 file changed

+3
-2
lines changed
  • applications/system/js_app/examples/apps/Scripts

1 file changed

+3
-2
lines changed

applications/system/js_app/examples/apps/Scripts/gui.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let filePicker = require("gui/file_picker");
1212
let widget = require("gui/widget");
1313
let icon = require("gui/icon");
1414
let flipper = require("flipper");
15+
let math = require("math");
1516

1617
// declare clock widget children
1718
let cuteDolphinWithWatch = icon.getBuiltin("DolphinWait_59x54");
@@ -138,15 +139,15 @@ eventLoop.subscribe(views.stopwatchWidget.button, function (_sub, buttonEvent, g
138139

139140
// count time
140141
eventLoop.subscribe(eventLoop.timer("periodic", 500), function (_sub, _item, views, stopwatchWidgetElements, halfSeconds) {
141-
let text = (halfSeconds / 2 / 60).toString();
142+
let text = math.floor(halfSeconds / 2 / 60).toString();
142143
if (halfSeconds < 10 * 60 * 2)
143144
text = "0" + text;
144145

145146
text += (halfSeconds % 2 === 0) ? ":" : " ";
146147

147148
if (((halfSeconds / 2) % 60) < 10)
148149
text += "0";
149-
text += ((halfSeconds / 2) % 60).toString();
150+
text += (math.floor(halfSeconds / 2) % 60).toString();
150151

151152
stopwatchWidgetElements[0].text = text;
152153
views.stopwatchWidget.setChildren(stopwatchWidgetElements);

0 commit comments

Comments
 (0)