Update app.js

This commit is contained in:
Namhyeon Go 2020-07-03 20:14:20 +09:00
parent 6c34f0da9c
commit 3fa5af6f4d

11
app.js
View File

@ -32,13 +32,12 @@
// The appname argument causes <appname>.js to be loaded. The interface returned // The appname argument causes <appname>.js to be loaded. The interface returned
// must define main = function(args) {}, which is called once the module is // must define main = function(args) {}, which is called once the module is
// loaded. // loaded.
var messages = []; var messages = [];
var console = { var console = {
log: function(msg, status) { log: function(msg, status) {
if(typeof(window) !== 'undefined') { if (typeof(window) !== 'undefined') {
if(typeof(window.jQuery) !== 'undefined') { if (typeof(window.jQuery) !== 'undefined') {
window.jQuery.toast({ window.jQuery.toast({
heading: "Information", heading: "Information",
text: msg, text: msg,
@ -47,7 +46,7 @@ var console = {
} else { } else {
messages.push(msg); messages.push(msg);
} }
} else if(typeof(WScript) !== 'undefined') { } else if (typeof(WScript) !== 'undefined') {
WScript.echo(msg); WScript.echo(msg);
WScript.quit(status); WScript.quit(status);
} }
@ -117,7 +116,7 @@ function init_window(name, args, w, h) {
var app = require(name); var app = require(name);
// set default size of window // set default size of window
if(typeof(w) !== "undefined" && typeof(h) !== "undefined") { if (typeof(w) !== "undefined" && typeof(h) !== "undefined") {
window.resizeTo(w, h); window.resizeTo(w, h);
} }
@ -135,7 +134,7 @@ function init_window(name, args, w, h) {
} }
function main() { function main() {
if(typeof(window) == 'undefined') { if (typeof(window) == 'undefined') {
init_console(); init_console();
} else { } else {
console.log("welcome"); console.log("welcome");