forked from tools/josh
1
0
Fork 0
josh/src/main/js/main.ts

25 lines
825 B
TypeScript
Raw Normal View History

2019-10-31 19:01:41 +01:00
import {addOnLoad, q} from "./shared";
import {Terminal} from "./terminal";
2019-10-27 01:22:23 +02:00
// TODO Ignore ts-ignore in whole block
2019-10-31 19:08:09 +01:00
// TODO Add interface for Window to add types
2019-10-27 01:22:23 +02:00
addOnLoad(() => {
// @ts-ignore: Force definition
window.terminal = new Terminal(
q("#terminal"),
q("#terminalCurrentFocusInput"),
q("#terminalOutput"),
q("#terminalCurrentPrefix")
);
// @ts-ignore: Force definition
2019-10-31 22:17:46 +01:00
window.relToAbs = (filename: string) => window.terminal.shell.fileSystem.getPathTo(filename).toString();
2019-10-27 01:22:23 +02:00
// @ts-ignore: Force definition
window.run = (command: string) => window.terminal.processInput(command);
2019-10-31 19:08:09 +01:00
// @ts-ignore: Force definition
2019-10-31 14:04:42 +01:00
if (window.terminal.shell.userSession.isLoggedIn)
2019-10-31 19:08:09 +01:00
// @ts-ignore: Force definition
2019-10-31 14:04:42 +01:00
window.terminal.processInput("ls");
2019-10-27 01:22:23 +02:00
});