fmt
This commit is contained in:
parent
a13f1f31d1
commit
9f41ffe7d1
|
@ -22,19 +22,19 @@ module.exports.setJSRunner = templates.setJSRunner
|
||||||
module.exports.FIND_ANY_HBS_REGEX = templates.FIND_ANY_HBS_REGEX
|
module.exports.FIND_ANY_HBS_REGEX = templates.FIND_ANY_HBS_REGEX
|
||||||
|
|
||||||
if (!process.env.NO_JS) {
|
if (!process.env.NO_JS) {
|
||||||
const vm = require("vm")
|
const vm = require("vm")
|
||||||
const { setJSRunner } = require("./helpers/javascript")
|
const {setJSRunner} = require("./helpers/javascript")
|
||||||
/**
|
/**
|
||||||
* Use vm to run JS scripts in a node Env
|
* Use vm to run JS scripts in a node Env
|
||||||
*/
|
*/
|
||||||
setJSRunner((js, context) => {
|
setJSRunner((js, context) => {
|
||||||
context = {
|
context = {
|
||||||
...context,
|
...context,
|
||||||
alert: undefined,
|
alert: undefined,
|
||||||
setInterval: undefined,
|
setInterval: undefined,
|
||||||
setTimeout: undefined,
|
setTimeout: undefined,
|
||||||
}
|
}
|
||||||
vm.createContext(context)
|
vm.createContext(context)
|
||||||
return vm.runInNewContext(js, context, {timeout: 1000})
|
return vm.runInNewContext(js, context, {timeout: 1000})
|
||||||
})
|
})
|
||||||
}
|
}
|
Loading…
Reference in New Issue