Maybe I'm trying to do too much, but I'm having a very difficult time getting either KEY or bind or bindAsync to work when inside a compiled word.
Example:
: testit
." ENTER A KEY "
KEY
." KEY WAS " .
;
testit
What ends up happening is that the window.prompt dialog comes up before anything is emitted, so that prompt text is invisible until I enter a key into the prompt dialog, then it all gets dumped out.
The same thing happens with synchronous or asynchronous bindings -- once inside a compiled word, there is no way (seemingly) to get any sort of interactive session that takes users input inside a word definition.
I don't know if it would work to have a type of bind to an async function that would await its return -- and thereby stop the Forth execution until that is done? (Ideally after dumping any emitted content, though that is something that could be done inside the async function itself if necessary).
Maybe I'm trying to do too much, but I'm having a very difficult time getting either
KEYorbindorbindAsyncto work when inside a compiled word.Example:
What ends up happening is that the
window.promptdialog comes up before anything is emitted, so that prompt text is invisible until I enter a key into the prompt dialog, then it all gets dumped out.The same thing happens with synchronous or asynchronous bindings -- once inside a compiled word, there is no way (seemingly) to get any sort of interactive session that takes users input inside a word definition.
I don't know if it would work to have a type of bind to an async function that would
awaitits return -- and thereby stop the Forth execution until that is done? (Ideally after dumping any emitted content, though that is something that could be done inside the async function itself if necessary).