(name, forHTML)
| 292 | |
| 293 | let sandboxes = {} |
| 294 | async function getSandbox(name, forHTML) { |
| 295 | name = name || "null" |
| 296 | if (sandboxes.hasOwnProperty(name)) return sandboxes[name] |
| 297 | let options = {loadFiles: window.page.load_files}, html |
| 298 | if (sandboxSnippets.hasOwnProperty(name)) { |
| 299 | let snippet = sandboxSnippets[name] |
| 300 | options.place = node => placeFrame(node, snippet) |
| 301 | if (!forHTML) html = snippet.textContent |
| 302 | } |
| 303 | let box = await Sandbox.create(options) |
| 304 | if (html != null) |
| 305 | box.win.document.documentElement.innerHTML = html |
| 306 | sandboxes[name] = box |
| 307 | return box |
| 308 | } |
| 309 | |
| 310 | function resetSandbox(name) { |
| 311 | if (!sandboxes.hasOwnProperty(name)) return |
no test coverage detected