Skip to content

Commit

Permalink
html: drop support for ie11
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed May 16, 2019
1 parent cd1241c commit de37a78
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 164 deletions.
21 changes: 8 additions & 13 deletions html/js/app.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import '../sass/app.scss';

// polyfills for ie11
import 'core-js/fn/array';
import 'core-js/fn/object';
import 'core-js/fn/promise';
import 'core-js/fn/typed';
import 'fast-text-encoding';

import { Terminal, ITerminalOptions, IDisposable } from 'xterm';
import * as fit from 'xterm/lib/addons/fit/fit'
import * as overlay from './overlay'
Expand All @@ -21,7 +14,9 @@ interface ITtydTerminal extends Terminal {
resizeDisposable: IDisposable;
dataDisposable: IDisposable;
reconnectTimeout: number;
showOverlay(msg: string, timeout?: number);

showOverlay(msg: string, timeout?: number): void;
fit(): void;
}

export interface IWindowWithTerminal extends Window {
Expand Down Expand Up @@ -140,7 +135,7 @@ let openWs = function() {
if (ws.readyState === WebSocket.OPEN) {
sendMessage('1' + JSON.stringify({columns: size.cols, rows: size.rows}));
}
setTimeout(() => (<any>term).showOverlay(size.cols + 'x' + size.rows), 500);
setTimeout(() => term.showOverlay(size.cols + 'x' + size.rows), 500);
});

term.onTitleChange((data: string) => {
Expand All @@ -158,12 +153,12 @@ let openWs = function() {
// https://stackoverflow.com/a/27923937/1727928
window.addEventListener('resize', () => {
clearTimeout(window.resizeTimeout);
window.resizeTimeout = <number><any>setTimeout(() => (<any>term).fit(), 250);
window.resizeTimeout = setTimeout(() => term.fit(), 250);
});
window.addEventListener('beforeunload', unloadCallback);

term.open(terminalContainer);
(<any>term).fit();
term.fit();
term.focus();
};

Expand Down Expand Up @@ -207,13 +202,13 @@ let openWs = function() {
term.resizeDisposable.dispose();
term.dataDisposable.dispose();
if (!wsError) {
(<any>term).showOverlay('Connection Closed', null);
term.showOverlay('Connection Closed', null);
}
}
window.removeEventListener('beforeunload', unloadCallback);
// 1000: CLOSE_NORMAL
if (event.code !== 1000 && autoReconnect > 0) {
term.reconnectTimeout = <number><any>setTimeout(openWs, autoReconnect * 1000);
term.reconnectTimeout = setTimeout(openWs, autoReconnect * 1000);
}
};
};
Expand Down
1 change: 0 additions & 1 deletion html/js/zmodem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as Promise from 'core-js/fn/promise';
import * as Zmodem from 'zmodem.js/src/zmodem_browser';

class Status {
Expand Down
5 changes: 0 additions & 5 deletions html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@
"start": "gulp clean && webpack-serve webpack.dev.js"
},
"dependencies": {
"core-js": "^2.5.3",
"fast-text-encoding": "^1.0.0",
"url-join": "^4.0.0",
"xterm": "^3.13.0",
"zmodem.js": "^0.1.7"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.8",
"gulp": "^3.9.1",
Expand Down
2 changes: 1 addition & 1 deletion html/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"sourceMap": true,
"module": "commonjs",
"target": "es5",
"lib": [ "dom", "es5"],
"lib": [ "dom", "es5", "es2015.promise"],
"jsx": "react",
"allowJs": true
}
Expand Down
10 changes: 0 additions & 10 deletions html/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ module.exports = {
},
module: {
rules: [
{
test: /\.js$/,
include: __dirname + '/node_modules/zmodem.js',
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
},
},
{
test: /\.tsx?$/,
use: 'ts-loader',
Expand Down
Loading

0 comments on commit de37a78

Please sign in to comment.