-
Notifications
You must be signed in to change notification settings - Fork 4
/
script.js
47 lines (32 loc) · 1.53 KB
/
script.js
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
43
44
45
46
47
// var correctNotes = [62,65,69];
// var userNotes = [];
// waxml.addEventListener("init", e => {
// // This logic applies to a waxmp-midi-controller inside a div with class= "subtractive"
// document.querySelector("div.subtractive waxml-midi-controller").addEventListener("keydown", e => {
// console.log(e.detail.keyNum);
// // add keyNum to userNotes
// userNotes.push(e.detail.keyNum);
// if(userNotes.length > correctNotes.length){
// // remove oldest note if userNotes are longer than correctNotes
// userNotes.shift();
// }
// // compare userNotes and correctNotes
// if(JSON.stringify(userNotes) == JSON.stringify(correctNotes)){
// // goto success page
// window.location.href = "#success";
// } else {
// // print a message in a HTML element (with class="respons")
// // (uncomment when you have such an element)
// // document.querySelector(".respons").innerHTML = "Keep on trying";
// console.log("Keep on trying");
// }
// });
// // // connect a function to a click on a link (in this case a link with id="btn1")
// // document.querySelector("#btn1").addEventListener("click", e => {
// // // do something. i.e. set a variable to a value
// // // set correctNotes to Twinkle Twinkle
// // correctNotes = [60,60,67,67,69,69,67];
// // // reset userNotes
// // userNotes = [];
// // });
// });