From 749719e477aa2f21f42d96a18a57c5b14396445e Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Mon, 5 Mar 2018 13:27:00 -0500 Subject: [PATCH] mse.mscript and mse.console for mscript editor features. --- app/js/app.js | 5 +++-- app/lib/ui/mscript.js | 11 ++++++++++- app/lib/ui/nav.js | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/js/app.js b/app/js/app.js index dde71fc..9839dd2 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -2493,6 +2493,7 @@ const seq = require('./lib/ui/seq.js'); const cmd = require('./lib/ui/cmd.js'); const log = require('./lib/ui/log.js'); const devices = require('./lib/ui/devices.js'); +const mse = require('./lib/ui/mscript.js'); const mscript = require('./lib/mscript'); @@ -2539,8 +2540,8 @@ function init () { 'use strict'; nav.init(); gui.grid.init(); - gui.mscript.init(); - gui.console.init(); + mse.mscript.init(); + mse.console.init(); log.init(); devices.init(); light.init(); diff --git a/app/lib/ui/mscript.js b/app/lib/ui/mscript.js index f87254f..032f8d2 100644 --- a/app/lib/ui/mscript.js +++ b/app/lib/ui/mscript.js @@ -39,6 +39,7 @@ mse.mscript.eval = function () { const data = mse.mscript.editor.getValue(); const output = mscript.interpret(data, function (output) { console.dir(output); + mse.console.print(JSON.stringify(output, null, '\t')) }); }; @@ -88,4 +89,12 @@ mse.console.newLine = function () { mse.console.elem.val(current); }; -module.exports = mse \ No newline at end of file +mse.console.print = function (str) { + 'use strict' + let current = mse.console.elem.val(); + current += '> '; + current += str; + mse.console.elem.val(current); +}; + +module.exports = mse; \ No newline at end of file diff --git a/app/lib/ui/nav.js b/app/lib/ui/nav.js index 3f9aa96..9d75935 100644 --- a/app/lib/ui/nav.js +++ b/app/lib/ui/nav.js @@ -34,7 +34,7 @@ nav.change = function (id) { light.rgb.set(light.color); } } else if (id === 'script') { - gui.mscript.open(); + mse.mscript.open(); } };