MCPcopy Index your code
hub / github.com/braziljs/eloquente-javascript / runCode

Method runCode

src/client/code.mjs:135–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

133 }
134
135 runCode() {
136 this.clearSandbox()
137 let val = this.editor.state.doc.toString(), type = this.editor.state.facet(language).name
138 let context = this.editor.state.facet(contextFacet)
139 Sandbox.create({
140 loadFiles: hasIncludes(val, context.include) ? [] : context.include,
141 emptyPath: "../",
142 place: type == "html" &&
143 function(node) {
144 let out = document.querySelector(".sandbox-output")
145 out.parentNode.insertBefore(node, out)
146 }
147 }).then(box => {
148 this.sandbox = box
149 this.output.clear()
150 if (type == "html")
151 box.setHTML(val, this.output)
152 else
153 box.run(val, this.output)
154 })
155 }
156
157 selectChapter(number, context) {
158 this.per.textContent = ""

Callers 1

constructorMethod · 0.95

Calls 8

clearSandboxMethod · 0.95
hasIncludesFunction · 0.85
facetMethod · 0.80
toStringMethod · 0.45
createMethod · 0.45
clearMethod · 0.45
setHTMLMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected