brumate

Introduction

brumate is a component language and a compiler for web apps that resume instead of hydrating. Pages arrive as HTML with their state in them, and the browser loads the code of the page without running the components again.

A component

Components are .brm files. A <script> declares state, and the markup reads it. This one runs in the page. Click the button, then edit the code:

App.brmEdit the code to run it again

The sample runs when it comes into view.

Resuming instead of hydrating

Most frameworks hydrate. The server renders HTML, then the browser downloads the code of every component and runs it again to rebuild the state and attach event listeners. The page cannot respond until that is done, and all component code ships, even code that only ever renders once.

brumate resumes:

What happens on the first click

For the counter above:

  1. The server renders the button and the paragraph, and writes count and double into the page.
  2. The page is ready. The browser loads the code of the click handler and of the updates of the two texts, in one bundle with the core.
  3. The click runs the handler.
  4. The handler adds one to count. The texts that read count and double update.

The compiler decides what each event needs when it compiles the component:

What runs where explains these rules in detail.

Next