Fix crashes when open the window

This commit is contained in:
Namhyeon Go 2022-11-29 02:49:58 +09:00
parent 327ef6c810
commit 8b0314a965
2 changed files with 11 additions and 5 deletions

2
app.js
View File

@ -70,7 +70,7 @@ var console = {
var params = { var params = {
type: type, type: type,
channel: 'default', channel: 'default',
messsage: '', message: '',
datetime: new Date().toISOString() datetime: new Date().toISOString()
}; };

View File

@ -9,7 +9,13 @@ var OldBrowser = require("lib/oldbrowser");
// Override global.console._echo() // Override global.console._echo()
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
global.console._echo = function(args, type) { global.console._echo = function(args, type) {
var heading, icon, msg = this._join(args); var heading, icon, message = this._join(args);
var params = {
type: type,
channel: 'default',
message: '',
datetime: new Date().toISOString()
};
switch(type) { switch(type) {
case "error": case "error":
@ -36,17 +42,17 @@ global.console._echo = function(args, type) {
if (typeof(window.jQuery.toast) !== "undefined") { if (typeof(window.jQuery.toast) !== "undefined") {
window.jQuery.toast({ window.jQuery.toast({
heading: heading, heading: heading,
text: msg, text: message,
icon: icon icon: icon
}); });
} else { } else {
window.alert(msg); window.alert(message);
} }
} catch (e) { } catch (e) {
window.alert(e.message); window.alert(e.message);
} }
this._messages.push(msg); this._messages.push(message);
if (params.channel != "default" && this._echoCallback != null) { if (params.channel != "default" && this._echoCallback != null) {
try { try {