57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
/**
|
|
* This file is an exception. It's licensed CC-0.
|
|
*/
|
|
class TestProgram implements JSTerminal.Program {
|
|
|
|
create(terminal: JSTerminal.Terminal, stdio: Std.IO) {
|
|
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: string) => {
|
|
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: string) => {
|
|
console.log(curr);
|
|
},
|
|
default: "heh"
|
|
});
|
|
}
|
|
|
|
enable() {
|
|
|
|
}
|
|
|
|
disable() {
|
|
|
|
}
|
|
|
|
onClose() {
|
|
return true;
|
|
}
|
|
|
|
}
|