MCPcopy Index your code
hub / github.com/RustPython/RustPython / updateSnippet

Function updateSnippet

wasm/demo/src/index.js:85–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83const snippets = document.getElementById('snippets');
84
85function updateSnippet() {
86 const selected = snippets.value;
87
88 // the require here creates a webpack context; it's fine to use it
89 // dynamically.
90 // https://webpack.js.org/guides/dependency-management/
91 const snippet = require(`../snippets/${selected}.py?raw`);
92
93 editor.dispatch({
94 changes: { from: 0, to: editor.state.doc.length, insert: snippet },
95 });
96}
97function updateSnippetAndRun() {
98 updateSnippet();
99 requestAnimationFrame(runCodeFromTextarea);

Callers 2

updateSnippetAndRunFunction · 0.85
index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected