Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

blok-ui/blok.platform.static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blok Platform Static

Server-side rendering for Blok.

Usage

Blok's static platform is designed to work seamlessly with blok.platform.dom. The only code that should be different is which Platform you use.

Right now, blok.ssr.Platform has only one static method: render. Using it might look something like this:

import blok.Html;
import blok.ssr.Platform;

function main() {
  Platform.render(
    Html.div({
      children: [ Html.text('foo') ]
    }),
    html -> trace(html),
    e -> trace(e.message)
  );
}

Platform.render's first callback is called every time the given component finishes rendering. The second can be used to handle any errors encountered when the app renders (but may be omitted if desired). Note that both callbacks may be called any number of times, and that the onRender callback will be invoked if ANY child component changes. This should give you the tools needed to handle asynchronous rendering.

... although I still need to test it.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages