Kitten

Reference sections

Terms as used in Kitten.

Static page

An .html or .htm file that’s served as-is, without any special processing. (During development, Kitten adds a script to it that gives you live reload when the page changes.) See Static files.

Dynamic page

A .page.js, .page.ts, or .page.md route that Kitten renders into HTML on each request. A dynamic page is either a stateless page or a stateful page. See Valid file types.

Stateless page

A dynamic page where the default export is a function. The function is a stateless component that Kitten calls on each request and that returns kitten.html. A Markdown page is stateless unless its front matter has a constructor section or stateful: true set. A stateless page that exports one or more on… event handlers is a live page.

Stateful page

A dynamic page where the default export is a kitten.Page subclass. Kitten instantiates your class on each request and each instance stores its own state in its properties for as long as the page is connected. Every stateful page is a live page. (A Markdown page that has a constructor section or stateful: true set in its front matter is also a stateful page. See Stateful Markdown pages.)

Live page

A live page is a dynamic page that automatically creates a WebSocket connection to its automatically-generated page socket route. Kitten uses this connection to enable its Streaming HTML workflow (where you respond to events emitted on the client with interface updates generated on the server that you stream to the client).

Every stateful page is a live page, and so are stateless pages that export one or more on… event handlers. Kitten keeps a live page in memory, accessible from kitten.pages, while it’s connected. (If a page doesn’t connect within ten seconds of the end of its response, Kitten assumes it was orphaned and garbage collects it.)

For more details, please see Streaming HTML, Page sockets, and Event handlers.

Stateless component

A function that returns kitten.html. It has no state of its own. You customise its output by passing it props which are applied on every render. See Stateless components.

Stateful component

A kitten.Component subclass. It stores its state in its properties, handles the events of the elements that you write in it with its on… methods, and streams updates of itself to the page. See Stateful components.

A stateful component needs a live page: you add it to the page, or to another stateful component on the page, with the addChild() method. On a stateless page that exports an on… event handler, Kitten creates a kitten.Page instance and binds your page function to it, so you can call this.addChild() in that function. A stateless page that isn’t live has no page instance.

Prop

Short for property. Used exclusively when referring to those properties specified as attributes in component and fragment tags in kitten.html. e.g.,

  <${MyComponent} aProp=${someValue} anotherProp=${someOtherValue} />

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.