From f7bd7789cce748e5548a85b694ef533c78f748cd Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 3 Jan 2018 18:15:51 +0100 Subject: [PATCH] provide setTimeout, setInterval in terminal --- src/app/panels/terminal.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index 9286df9690..c89d52684d 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -702,7 +702,15 @@ function domTerminalFeatures (self, scopedCommands) { log: function () { scopedCommands.log.apply(scopedCommands, arguments) }, info: function () { scopedCommands.info.apply(scopedCommands, arguments) }, error: function () { scopedCommands.error.apply(scopedCommands, arguments) } - } + }, + setTimeout: (fn, time) => { + return setTimeout(() => { self._shell('(' + fn.toString() + ')()', scopedCommands, () => {}) }, time) + }, + setInterval: (fn, time) => { + return setInterval(() => { self._shell('(' + fn.toString() + ')()', scopedCommands, () => {}) }, time) + }, + clearTimeout: clearTimeout, + clearInterval: clearInterval } }