Re:Show HN: TxtFiddle – JavaScript playground for text manip...
by high_byte on Wednesday March 24, 2021 @01:06PM
(#26570009)
so this is basically eval('var input = inputElement.innerText;' + jsElement.innerText)
[ Parent
| on HN ]
Re:Show HN: TxtFiddle – JavaScript playground for text manip...
by awulf on Wednesday March 24, 2021 @05:33PM
(#26573224)
Basically, yes. In practice, there's a bit more to it. The user code is wrapped into an "async function(input)" (so you can use async/await) and run inside a worker inside a sandboxed iframe (for security reasons and for being able to stop the execution). There's also some additional code for catching errors and parsing the error stack.