Skip to main content

Module page

Module page 

Source
Expand description

Files from the page, on the web: the text files the page a web build runs in holds, read into a bundle layer (ADR-0004 §1) the game lays over its own files, and the game’s problems with them sent back (report). It is how a page that edits a game’s data beside it (the site’s playground) runs the game on its edits with no install. On every other target the page holds none.

The page writes each file to sessionStorage under shuyi-page-file:<path>, <path> being the file’s path in the game’s project (files/stage.map); page_layer takes those under one folder. The shuyi_page_files miniquad plugin in crates/cli/web/page-files.js (our own code, loaded by crates/cli/web/index.html) reads them.

Structs§

PageLimits
How big the page’s files may be (page_layer). Build it with PageLimits::new or take the default: a struct literal doesn’t compile outside this crate, so a new field never breaks a game (ADR-0039).

Enums§

PageError
Why the page’s files could not be read into a layer (page_layer).

Functions§

page_layer
The page’s files under the folder name (files), as one layer named name, each at its path after the folder: files/stage.map is the layer’s stage.map, and the bundle shows it as files/stage.map, as cargo shuyi check names the game’s own. With name empty, every file of the page, at its path. None when the page holds none there, and on every target but the web. Read it once, at the start: the layer’s files are kept for the life of the program, and the page runs the game again to change them.
report
Sends the page text: the game’s problems with the page’s files, one a line, each with its file and line as cargo shuyi check prints them; the empty text when they load. The page’s parent frame gets it as a { kind: "shuyi-report", text } message when it has the page’s origin, and the console otherwise. On every target but the web it does nothing.