The home page shows at once
It was blank until every module had loaded and the page's examples had been run, a fuzzer's report among them (about a second of work): first paint came 1.3 seconds into a repeat visit and about 3 into a first one. - The assembler draws the home page once, in Node, with the app's own homeView, and puts it inside #app. The browser paints it with the HTML and the stylesheet. - When the app has loaded it draws the page again, with its controls, and puts it in the prerendered one's place; the fuzzer's reports and the proof's counts are copied from the prerendered page, not worked out again. - The prerendered page shows only on the home address: the page's first inline script marks it before the first paint, and without the mark it stays hidden, so an embed or a problem's address never shows it. That script changed, and its hash in docs/Caddyfile with it. Served locally, first paint is at 0.1 to 0.2 seconds and the page with its controls at 0.2 to 0.3; both were at 1.2 to 1.4.
This commit is contained in:
12 files changed
+154
-19
No files matched your search
@@ -105,6 +105,8 @@ A student can save the state of their work under a name and come back to any sav
|
||||
|
||||
**Work that takes the page down.** The engines stop a program that runs too long or makes values too large (core's [limits.md](../core/docs/limits.md)), but should a program still use up the tab's memory first, the browser kills the page. Saved work runs again as the page opens, so before it runs its save is marked busy in this tab (`src/core/guard.ts`, in `sessionStorage`), and the mark is cleared once the page has been idle for a moment and when it closes normally. A reload that finds the mark puts that save aside as a named version, "When the page stopped (time)", opens the problem as written, and says so; an embed drops the reader's edits instead. If a saved state makes the page fail in any other way, the page that says so offers the same: keep the work as a version and open the problem as written.
|
||||
|
||||
The home page is the one page that is drawn before the app starts: the assembled site carries it prerendered (`docs/deploy.md`), and `homeView` then takes its place. A part of it that is costly to work out and holds no control is wrapped in `kept(key, build)` (`src/ui/prerender.ts`), which copies it from the prerendered page; give a new part of that kind the same wrapper, and never one with a listener, since a copy has none.
|
||||
|
||||
Nothing else is a route: `#/p/<problem>`, `#/s/<state>` and the other earlier forms open the home page, with a note at the foot of the page that there is no page at that address (`isUnknownRoute` in `src/core/state.ts`). A problem or library routine that does not exist, in the app or in an embed, is a page that says so (in the app it keeps the site's navigation and links the problem list); so is a link that does not open (below). `<view>` is `playground` (the whole workspace; `?area=dev` picks the area, Bridge by default or the problem's own), `trace`, `table`, `flow`, `data`, `life`, `proof`, `tests`, `problems`, `compiler`, `asm` (the machine numbers), or a pane name (`lingo`, `pseudo`, `speco`, `mojo`, `asm`) to show just that editor with its problems under it. Query parameters on an embed: `?t=12` parks the stepper, `?ro=1` makes the editor read-only; `area`, `panel`, `lang`, `build`, `machine`, `dock`, `docktab`, `editor`, `side`, `dockheight` and `theme` arrange the example as the playground's controls do (`applyEmbedParams` in `src/core/state.ts`).
|
||||
|
||||
A reader's edits in an embed are saved in their browser, in that embed's own save (one per embedded example, shared by pages that embed the same one), never in the app's save for the problem. Once they have changed something, **Reset** appears beside "open in Programming+" and puts the author's version back. An embed keeps a save only while it holds edits, so a reader who has not changed an example always sees the author's current version. A read-only embed (`?ro=1`) saves nothing.
|
||||
|
||||
Reference in new issue
Block a user