Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ and `cjFileBlob(path)` also work.
`/files/uploads/` exists for files the page adds there.
- The browser console gets whole lines, so two `print` calls and a `println` log one
line. A partial line is logged after 100 ms.
- `javaWebWriteStdin(text)` feeds `System.in` (CheerpJ has no such call). A read
waits until the page sends text, and text sent before Java reads it is kept.
`javaWebWriteStdin(null)` ends the input. Nothing is echoed, so the page shows
what the user typed itself.

Library mode calls Java from JS, as in CheerpJ's library mode guide. The VM
stays up between calls:
Expand Down
1 change: 1 addition & 0 deletions src/browser/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export function cheerpOSRemoveStringFile(path: string) {

// Feeds System.in; null ends the input.
export function javaWebWriteStdin(data: string | null) {
if (!worker) throw new Error("call cheerpjInit() first");
send({ type: "stdin", data: data === null ? null : new TextEncoder().encode(data) });
}

Expand Down
Loading