From 3dd7b98c0295bdf99b1ac0c5b652dcecd76969f2 Mon Sep 17 00:00:00 2001 From: Sheng Date: Thu, 23 Aug 2018 18:15:10 +0800 Subject: [PATCH] Defined a method onerror on reader --- webssh/static/js/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js index 15f3546..6f20c01 100644 --- a/webssh/static/js/main.js +++ b/webssh/static/js/main.js @@ -213,7 +213,7 @@ jQuery(function($){ sock.onmessage = function(msg) { var reader = new window.FileReader(); - reader.onloadend = function(){ + reader.onload = function(){ var text = decoder.decode(reader.result); // console.log(text); if (term) { @@ -225,11 +225,15 @@ jQuery(function($){ } }; + reader.onerror = function(e) { + console.error(e); + }; + reader.readAsArrayBuffer(msg.data); }; sock.onerror = function(e) { - console.log(e); + console.error(e); }; sock.onclose = function(e) {