mirror of
https://github.com/yudai/gotty.git
synced 2026-01-06 01:28:50 +01:00
Run make tsfmt and make test
This formats all the go & ts files
This commit is contained in:
parent
765000bd61
commit
1de0cc6790
7 changed files with 52 additions and 52 deletions
2
Makefile
2
Makefile
|
|
@ -75,7 +75,7 @@ test:
|
|||
if [ $$(go fmt $$(go list ./...) | wc -l) -gt 0 ]; then echo "go fmt error"; exit 1; fi
|
||||
cd js && npx tsfmt -r --verify
|
||||
|
||||
.PHONY: fmt
|
||||
.PHONY: tsfmt
|
||||
tsfmt:
|
||||
cd js && npx tsfmt -r
|
||||
|
||||
|
|
|
|||
2
js/dist/main.d.ts
vendored
2
js/dist/main.d.ts
vendored
|
|
@ -1 +1 @@
|
|||
export {};
|
||||
export { };
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ export class Hterm {
|
|||
};
|
||||
|
||||
setPreferences(value: object) {
|
||||
Object.keys(value).forEach((key) => {
|
||||
if (key != "enable-webgl") {
|
||||
this.term.getPrefs().set(key, value[key]);
|
||||
}
|
||||
});
|
||||
Object.keys(value).forEach((key) => {
|
||||
if (key != "enable-webgl") {
|
||||
this.term.getPrefs().set(key, value[key]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onInput(callback: (input: string) => void) {
|
||||
|
|
@ -77,9 +77,9 @@ export class Hterm {
|
|||
};
|
||||
|
||||
deactivate(): void {
|
||||
this.io.onVTKeystroke = function(){};
|
||||
this.io.sendString = function(){};
|
||||
this.io.onTerminalResize = function(){};
|
||||
this.io.onVTKeystroke = function() { };
|
||||
this.io.sendString = function() { };
|
||||
this.io.onTerminalResize = function() { };
|
||||
this.term.uninstallKeyboard();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import {lib} from "libapps";
|
||||
|
||||
import {IDisposable, Terminal} from 'xterm';
|
||||
import {FitAddon} from "xterm-addon-fit";
|
||||
import {WebglAddon} from "xterm-addon-webgl";
|
||||
import { lib } from "libapps";
|
||||
|
||||
import { IDisposable, Terminal } from "xterm";
|
||||
import { FitAddon } from "xterm-addon-fit";
|
||||
import { WebglAddon } from "xterm-addon-webgl";
|
||||
|
||||
export class Xterm {
|
||||
elem: HTMLElement;
|
||||
|
|
@ -15,13 +14,13 @@ export class Xterm {
|
|||
messageTimeout: number;
|
||||
messageTimer: NodeJS.Timer;
|
||||
|
||||
fitAddon: FitAddon;
|
||||
disposables: IDisposable[] = [];
|
||||
fitAddon: FitAddon;
|
||||
disposables: IDisposable[] = [];
|
||||
|
||||
|
||||
constructor(elem: HTMLElement) {
|
||||
this.elem = elem;
|
||||
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0;
|
||||
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0;
|
||||
this.term = new Terminal({
|
||||
cursorStyle: "block",
|
||||
cursorBlink: true,
|
||||
|
|
@ -30,20 +29,20 @@ export class Xterm {
|
|||
fontSize: 12,
|
||||
});
|
||||
|
||||
this.fitAddon = new FitAddon();
|
||||
this.term.loadAddon(this.fitAddon);
|
||||
this.fitAddon = new FitAddon();
|
||||
this.term.loadAddon(this.fitAddon);
|
||||
|
||||
this.message = elem.ownerDocument.createElement("div");
|
||||
this.message.className = "xterm-overlay";
|
||||
this.messageTimeout = 2000;
|
||||
|
||||
this.resizeListener = () => {
|
||||
this.fitAddon.fit();
|
||||
this.fitAddon.fit();
|
||||
this.term.scrollToBottom();
|
||||
this.showMessage(String(this.term.cols) + "x" + String(this.term.rows), this.messageTimeout);
|
||||
};
|
||||
|
||||
this.term.open(elem);
|
||||
this.term.open(elem);
|
||||
|
||||
this.term.focus()
|
||||
this.resizeListener();
|
||||
|
|
@ -85,28 +84,28 @@ export class Xterm {
|
|||
};
|
||||
|
||||
setPreferences(value: object) {
|
||||
Object.keys(value).forEach((key) => {
|
||||
if (key && key == "enable-webgl") {
|
||||
this.term.loadAddon(new WebglAddon());
|
||||
}
|
||||
});
|
||||
Object.keys(value).forEach((key) => {
|
||||
if (key && key == "enable-webgl") {
|
||||
this.term.loadAddon(new WebglAddon());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onInput(callback: (input: string) => void) {
|
||||
this.disposables.push(this.term.onData((data) => {
|
||||
callback(data);
|
||||
}));
|
||||
this.disposables.push(this.term.onData((data) => {
|
||||
callback(data);
|
||||
}));
|
||||
|
||||
};
|
||||
|
||||
onResize(callback: (colmuns: number, rows: number) => void) {
|
||||
this.disposables.push(this.term.onResize((data) => {
|
||||
callback(data.cols, data.rows);
|
||||
}));
|
||||
this.disposables.push(this.term.onResize((data) => {
|
||||
callback(data.cols, data.rows);
|
||||
}));
|
||||
};
|
||||
|
||||
deactivate(): void {
|
||||
this.disposables.forEach(d => d.dispose())
|
||||
this.disposables.forEach(d => d.dispose())
|
||||
this.term.blur();
|
||||
}
|
||||
|
||||
|
|
@ -117,6 +116,6 @@ export class Xterm {
|
|||
|
||||
close(): void {
|
||||
window.removeEventListener("resize", this.resizeListener);
|
||||
this.term.dispose();
|
||||
this.term.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"strictNullChecks": true,
|
||||
"noUnusedLocals" : true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"outDir": "./dist/",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"target": "es5",
|
||||
"module": "commonJS",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*": ["./typings/*"]
|
||||
}
|
||||
"newLine": "LF",
|
||||
"strictNullChecks": true,
|
||||
"noUnusedLocals" : true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"outDir": "./dist/",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"target": "es5",
|
||||
"module": "commonJS",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*": ["./typings/*"]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
2
js/typings/libapps/index.d.ts
vendored
2
js/typings/libapps/index.d.ts
vendored
|
|
@ -37,7 +37,7 @@ export declare namespace lib {
|
|||
}
|
||||
|
||||
export interface Memory {
|
||||
new (): Storage;
|
||||
new(): Storage;
|
||||
Memory(): Storage
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
"github.com/fatih/structs"
|
||||
"github.com/urfave/cli"
|
||||
"github.com/yudai/hcl"
|
||||
|
||||
"github.com/ghthor/gotty/v2/pkg/homedir"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue