Teascade.net/public/terminal/js/testprogram.js
2018-04-20 09:16:01 +03:00

49 lines
1.5 KiB
JavaScript

/**
* This file is an exception. It's licensed CC-0.
*/
class TestProgram {
create(terminal, stdio) {
let ref = stdio.loadSound("audio/battle_music.ogg", (ref) => {
let sound = {
soundRefrence: ref,
onStartCallback: () => {
console.log("I started!");
},
onEndCallback: () => {
console.log("I ended :(");
}
};
stdio.playSound(0, sound);
});
stdio.println("Welcome to a tour! This is a tour for JSh, a platform for the upcoming JSX!");
stdio.println("\nFirst things first:\nWho are you?");
stdio.refresh();
stdio.readline({
prefix: "\n> ",
callback: (resp) => {
console.log("got: " + resp);
stdio.println("Hello, '");
stdio.print(resp, "red");
stdio.print("', I am JSh, the JavaScript Bash.");
stdio.println("I am but a mere tool that can print and read stuff from the terminal");
stdio.stopSound(0);
terminal.closeProgram(this);
},
printAfterDone: true,
style: "red",
hidden: false,
onChangeCallback: (curr) => {
console.log(curr);
},
default: "heh"
});
}
enable() {
}
disable() {
}
onClose() {
return true;
}
}