summaryrefslogtreecommitdiff
path: root/platform/javascript/engine/engine.js
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-05-01 14:45:45 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-05-10 18:22:48 +0200
commit7411e7fd37eb169b0f0675d4e4c2ec28786aec1b (patch)
treec01eaed2b567144b74be62c983c0651c78e4e8fb /platform/javascript/engine/engine.js
parent11a81341fac2f68562d952fa4f956129cd2410a6 (diff)
DisplayServerJavaScript implementation.
Diffstat (limited to 'platform/javascript/engine/engine.js')
-rw-r--r--platform/javascript/engine/engine.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/javascript/engine/engine.js b/platform/javascript/engine/engine.js
index 69c5eeb387..aecc6b9432 100644
--- a/platform/javascript/engine/engine.js
+++ b/platform/javascript/engine/engine.js
@@ -31,6 +31,7 @@ Function('return this')()['Engine'] = (function() {
this.rtenv = null;
this.customLocale = null;
this.resizeCanvasOnStart = false;
+ this.onExecute = null;
this.onExit = null;
};
@@ -115,6 +116,7 @@ Function('return this')()['Engine'] = (function() {
me.rtenv['thisProgram'] = me.executableName;
me.rtenv['resizeCanvasOnStart'] = me.resizeCanvasOnStart;
me.rtenv['noExitRuntime'] = true;
+ me.rtenv['onExecute'] = me.onExecute;
me.rtenv['onExit'] = function(code) {
if (me.onExit)
me.onExit(code);
@@ -201,6 +203,12 @@ Function('return this')()['Engine'] = (function() {
stderr = printErr;
};
+ Engine.prototype.setOnExecute = function(onExecute) {
+ if (this.rtenv)
+ this.rtenv.onExecute = onExecute;
+ this.onExecute = onExecute;
+ }
+
Engine.prototype.setOnExit = function(onExit) {
this.onExit = onExit;
}
@@ -230,6 +238,7 @@ Function('return this')()['Engine'] = (function() {
Engine.prototype['setProgressFunc'] = Engine.prototype.setProgressFunc;
Engine.prototype['setStdoutFunc'] = Engine.prototype.setStdoutFunc;
Engine.prototype['setStderrFunc'] = Engine.prototype.setStderrFunc;
+ Engine.prototype['setOnExecute'] = Engine.prototype.setOnExecute;
Engine.prototype['setOnExit'] = Engine.prototype.setOnExit;
Engine.prototype['copyToFS'] = Engine.prototype.copyToFS;
return Engine;