https://github.com/skulpt/skulpt/issues/685

https://github.com/skulpt/skulpt/issues/685

 

Yes, you need to pass in your own function during the configuration.

Example:

Sk.configure({
    inputfun: yourFunction,
    inputfunTakesPrompt: true /* then you need to output the prompt yourself */
});

// example function with promise

function yourFunction(prompt) {
    return new Promise((resolve, reject) => {
        // ToDo: output prompt
        // ToDo: get input string
        let input = "hm";
        resolve(input);
    };
}
posted @ 2024-09-12 16:22  China Soft  阅读(2)  评论(0编辑  收藏  举报