From 640e3354fffd9f05306ca728c5d8c4a73bd76353 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Sat, 21 May 2022 04:15:12 +0100 Subject: :rocket: Deploy docs to GitHub Pages./mybackend -o test.s test.cl --- docs/lustre.html | 512 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 512 insertions(+) create mode 100644 docs/lustre.html (limited to 'docs/lustre.html') diff --git a/docs/lustre.html b/docs/lustre.html new file mode 100644 index 0000000..5c851e8 --- /dev/null +++ b/docs/lustre.html @@ -0,0 +1,512 @@ + + + + + + lustre - lustre + + + + + + + + + + + + +
+ + +
+ +

+ lustre + +

+ + + +
+

+ Types + +

+ + +
+
+

+ + Attribute + +

+ + +
+
+
+
pub type Attribute(action) =
+  attribute.Attribute(action)
+ + +
+
+ +
+
+

+ + Cmd + +

+ + +
+
+
+
pub type Cmd(action) =
+  cmd.Cmd(action)
+ + +
+
+ +
+
+

+ + Element + +

+ + +
+
+
+
pub type Element(action) =
+  element.Element(action)
+ + +
+
+ +
+
+

+ + Error + +

+ + +
+
+
+
pub type Error {
+  ElementNotFound
+}
+ +

+ Constructors +

+
    + +
  • +
    + +
    ElementNotFound
    +
    + +
    + + + + +
    +
  • + +
+ +
+
+ +
+
+

+ + Program + +

+ + +
+
+
+
pub opaque type Program(state, action)
+ + +
+
+ +
+ + + + + + +
+

+ Functions + +

+ +
+
+

+ + application + +

+ + +
+
pub fn application(init: #(a, Cmd(b)), update: fn(a, b) ->
+    #(a, Cmd(b)), render: fn(a) -> Element(b)) -> Program(a, b)
+

Create a more complex application mimicing TEA – the Elm architecture. We +start with some initial state, a function to update that state, and then +a render function to derive our program’s view from that state.

+

Events produced by elements are passed a dispatch function that can be +used to emit actions that trigger your update function to be called and +trigger a rerender.

+
+
+ +
+
+

+ + basic + +

+ + +
+
pub fn basic(element: Element(a)) -> Program(Nil, a)
+

Create a basic lustre program that just renders some element on the page. +Note that this doesn’t mean the content is static! With element.stateful +you can still create components with local state.

+

Basic lustre programs don’t have any global application state and so the +plumbing is a lot simpler. If you find yourself passing lot’s state of state +around, you might want to consider using application instead.

+
+
+ +
+
+

+ + start + +

+ + +
+
pub fn start(program: Program(a, b), selector: String) -> Result(
+  fn(b) -> Nil,
+  Error,
+)
+

Once you have created a program with either basic or application, you +need to actually start it! This function will mount your program to the DOM +node that matches the query selector you provide.

+

If everything mounted OK, we’ll get back a dispatch function that you can +call to send actions to your program and trigger an update.

+
+
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3