Kiln / Components
Start here01
The language02
- 01The basics
- 02Values and numbers
- 03Variables
- 04Calls and expressions
- 05Conditions and loops
- 06Strings
- 07Arrays and hashes
- 08Classes and records
- 09Traits and enums
- 10Blocks
- 11Methods
- 12Imports and exports
- 13Foreign files
- 14Failures
Programs and the world03
- 01Files, input and output
- 02JSON, time, URLs and random numbers
- 03Html and forms
- 04Templates: Ochre
- 05Built-in methods
Kiln04
04 Kiln / 04
Components
Parts of a page the browser works out, in Hematite, and how Kiln serves them.
What changes only the page, like choosing a size, counting, or showing what's typed as it's typed, needs nothing from the server: a template with a client block is a component, which the browser works out (see components in the language's guide).
Kiln compiles the app's components for the browser when it starts, and serves what they need under /.hem/, compressed for a browser that takes it so: pages with components load /.hem/components.js, which runs them on Hematite's own VM, built for WebAssembly; a page without components loads nothing.
A browser keeps the VM and the components' program for good, since their names change when they do, and asks about components.js each time, which costs it a few bytes when nothing changed. A component whose code the browser can't run (a database, files or C) is a failure when the server starts, at its place.
This one is on this page, working. Press it: