MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / input

Function input

tools/client-plugins/browser-scripts/python-worker.ts:87–102  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

85 }
86
87 function input(text: string) {
88 // TODO: send unique ids to the main thread and the service worker, so we
89 // can have multiple concurrent input requests.
90 postMessage({ type: 'input', text });
91 const request = new XMLHttpRequest();
92 request.open('POST', '/python/intercept-input/', false);
93 request.send(null);
94
95 // We want to raise a KeyboardInterrupt if the user cancels. To do that,
96 // this function returns a JS object with the 'type' property set to
97 // 'cancel'. Then the python code can actually raise the exception.
98 return JSON.parse(request.responseText) as {
99 type: 'msg' | 'cancel';
100 value?: string;
101 };
102 }
103
104 function __interruptExecution() {
105 postMessage({ type: 'reset' });

Callers 5

create-project.tsFile · 0.50
create-quiz.tsFile · 0.50
rename-block.tsFile · 0.50
newChallengePromptsFunction · 0.50

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected