-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreminder-app
More file actions
47 lines (31 loc) · 919 Bytes
/
Copy pathreminder-app
File metadata and controls
47 lines (31 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var totalReminders = [];
var newRem = "";
var counterIndex = 0;
var currentCount = 0;
setText("reminderOutput", "Add reminders!");
onEvent("addButton", "click", function( ) {
newRem = getText("reminderInput");
appendItem(totalReminders, newRem);
setText("reminderInput", "");
currentCount = currentCount + 1;
setText("countOutput", counterIndex + 1);
update();
});
// RIGHT BUTTON
onEvent("rightButton", "click", function( ) {
if (counterIndex < totalReminders.length-1) {
counterIndex = counterIndex + 1;
setText("countOutput", counterIndex + 1);
update();
}});
// LEFT BUTTON
onEvent("leftButton", "click", function( ) {
if (counterIndex > 0){
counterIndex = counterIndex - 1;
setText("countOutput", counterIndex + 1);
update();
}});
function update() {
var currentRem = totalReminders[counterIndex];
setProperty("reminderOutput","text", currentRem);
}