jetstart
Small, simple, functional JavaScript library for building web interfaces.
Jetstart integrates lit-html, page.js, and statezero.
See the jetstart-boilerplate project to get started.
Getting Started
Install from npm.
npm install jetstart --save
Jetstart is packaged using the Universal Module Definition pattern, so it can be loaded in various environments:
Browser Global
ES6 Module
;
Node
const action router view = ;
Concepts
Views
Views are invoked with a context
argument, which can be destructured like so:
;
The context
object contains all of the names exported by lit-html, including all of its
directives, as well as a few
Jetstart-specific properties:
Name | Type | Description |
---|---|---|
html | Function | Wraps lit-html's html() to add support for Jetstart views |
render | Function | Views in jetstart typically return the result of calling render on a tagged template literal |
repeatView | Function | Like repeat , but called with a function that returns a view instead of a template |
state | Object | The result of calling statezero's getState() function |
Views can also accept arbitrary parameters, such as the text
parameter of the span
view below:
; const span = ; const header = ; ;
See lit-html for more information.
State
Jetstart uses statezero to manage a single, global, immutable state
graph. Changes to state can be applied by calling commit(newState)
, which causes all views to be (efficiently)
re-rendered.
; const time = ; const updateTime = ; ; ;
See statezero for more information.
Routing
; const foo = ; const bar = ; start;
See page.js for more information.
Developing
npm install
npm run build