Port addons to new applyAddon API and TypeScript

This commit is contained in:
Paris Kasidiaris
2017-12-12 08:46:06 +00:00
parent 2547858efb
commit 510de73996
26 changed files with 490 additions and 570 deletions
+9 -9
View File
@@ -16,16 +16,16 @@
* should happen instantly or at a maximum
* frequency of 1 rendering per 10ms.
*/
function attach (term, socket, bidirectional, buffered) {
function attach(term, socket, bidirectional, buffered) {
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
term.socket = socket;
term._flushBuffer = function () {
term._flushBuffer = function() {
term.write(term._attachSocketBuffer);
term._attachSocketBuffer = null;
};
term._pushToBuffer = function (data) {
term._pushToBuffer = function(data) {
if (term._attachSocketBuffer) {
term._attachSocketBuffer += data;
} else {
@@ -36,7 +36,7 @@ function attach (term, socket, bidirectional, buffered) {
var myTextDecoder;
term._getMessage = function (ev) {
term._getMessage = function(ev) {
var str;
if (typeof ev.data === "object") {
if (ev.data instanceof ArrayBuffer) {
@@ -58,7 +58,7 @@ function attach (term, socket, bidirectional, buffered) {
}
};
term._sendData = function (data) {
term._sendData = function(data) {
socket.send(data);
};
@@ -79,7 +79,7 @@ function attach (term, socket, bidirectional, buffered) {
* @param {WebSocket} socket - The socket from which to detach the current
* terminal.
*/
function detach (term, socket) {
function detach(term, socket) {
term.off('data', term._sendData);
socket = (typeof socket == 'undefined') ? term.socket : socket;
@@ -92,7 +92,7 @@ function detach (term, socket) {
};
export default function applyOn(terminalConstructor) {
export function apply(terminalConstructor) {
/**
* Attaches the current terminal to the given socket
*
@@ -103,7 +103,7 @@ export default function applyOn(terminalConstructor) {
* should happen instantly or at a maximum
* frequency of 1 rendering per 10ms.
*/
terminalConstructor.prototype.attach = function (socket, bidirectional, buffered) {
terminalConstructor.prototype.attach = function(socket, bidirectional, buffered) {
return exports.attach(this, socket, bidirectional, buffered);
};
@@ -113,7 +113,7 @@ export default function applyOn(terminalConstructor) {
* @param {WebSocket} socket - The socket from which to detach the current
* terminal.
*/
terminalConstructor.prototype.detach = function (socket) {
terminalConstructor.prototype.detach = function(socket) {
return exports.detach(this, socket);
};
}