3Elm application lifecycle for LynxJS. Replaces browser DOM rendering with LynxJS PAPI calls via `globalThis.page` and `__FlushElementTree()`.
13 "lynxjs-elm/browser": "1.0.0"
21- [`Browser`](#browser) — Program entry points (sandbox, element, document, application)
22- [`Browser.Dom`](#browserdom) — Viewport queries, focus/blur
23- [`Browser.Events`](#browserevents) — Global event subscriptions (animation, keyboard, mouse, window)
24- [`Browser.Navigation`](#browsernavigation) — URL navigation (stubbed in LynxJS)
39 , view : model -> VirtualDom.Node msg
40 , update : msg -> model -> model
42 -> Program () model msg
45Create a sandboxed program with no side effects. Good for learning and prototyping.
49 { init : flags -> ( model, Cmd msg )
50 , view : model -> VirtualDom.Node msg
51 , update : msg -> model -> ( model, Cmd msg )
52 , subscriptions : model -> Sub msg
54 -> Program flags model msg
57Create a program with commands and subscriptions.
61 { init : flags -> ( model, Cmd msg )
62 , view : model -> Document msg
63 , update : msg -> model -> ( model, Cmd msg )
64 , subscriptions : model -> Sub msg
66 -> Program flags model msg
69Like `element` but the view returns a `Document`:
72type alias Document msg =
74 , body : List (VirtualDom.Node msg)
78Note: `title` is ignored in LynxJS. It exists for API compatibility with elm/browser.
82 { init : flags -> Url.Url -> Key -> ( model, Cmd msg )
83 , view : model -> Document msg
84 , update : msg -> model -> ( model, Cmd msg )
85 , subscriptions : model -> Sub msg
86 , onUrlRequest : UrlRequest -> msg
87 , onUrlChange : Url.Url -> msg
89 -> Program flags model msg
92URL-managing application. URL support is stubbed in LynxJS — `init` receives a dummy localhost URL.
104import Lynx exposing (..)
105import Lynx.Attributes exposing (..)
106import Lynx.Events exposing (..)
115type Msg = Increment | Decrement
119 Increment -> model + 1
120 Decrement -> model - 1
123 Lynx.view [ alignItems "center", padding 20 ]
124 [ Lynx.view [ onTap Decrement ] [ Lynx.text [] [ textContent "-" ] ]
125 , Lynx.text [ fontSize 48 ] [ textContent (String.fromInt model) ]
126 , Lynx.view [ onTap Increment ] [ Lynx.text [] [ textContent "+" ] ]
1321. Virtual DOM tree rendered to native view objects
1332. Appended to `globalThis.page` (LynxJS root node)
1343. `__FlushElementTree()` called to sync native UI
1354. On each update: diff, patch, then flush again
145**Note:** Most DOM queries are stubbed in LynxJS. Element lookups by ID return `NotFound`.
150type Error = NotFound String
155 { scene : { width : Float, height : Float }
156 , viewport : { x : Float, y : Float, width : Float, height : Float }
162 { scene : { width : Float, height : Float }
163 , viewport : { x : Float, y : Float, width : Float, height : Float }
164 , element : { x : Float, y : Float, width : Float, height : Float }
171focus : String -> Task Error ()
172blur : String -> Task Error ()
175Focus or blur an element by ID. Stubbed in LynxJS.
180getViewport : Task x Viewport
181setViewport : Float -> Float -> Task x ()
182getViewportOf : String -> Task Error Viewport
183setViewportOf : String -> Float -> Float -> Task Error ()
189getElement : String -> Task Error Element
192Get position and size of an element by ID. Stubbed in LynxJS.
202**Note:** Global event subscriptions are stubbed in LynxJS. These functions exist for API compatibility but subscriptions won't fire.
207onAnimationFrame : (Time.Posix -> msg) -> Sub msg
208onAnimationFrameDelta : (Float -> msg) -> Sub msg
211Subscribe to animation frames (~60 fps). `onAnimationFrameDelta` provides milliseconds since the last frame.
216onKeyPress : Json.Decoder msg -> Sub msg
217onKeyDown : Json.Decoder msg -> Sub msg
218onKeyUp : Json.Decoder msg -> Sub msg
224onClick : Json.Decoder msg -> Sub msg
225onMouseMove : Json.Decoder msg -> Sub msg
226onMouseDown : Json.Decoder msg -> Sub msg
227onMouseUp : Json.Decoder msg -> Sub msg
233onResize : (Int -> Int -> msg) -> Sub msg
234onVisibilityChange : (Visibility -> msg) -> Sub msg
238type Visibility = Visible | Hidden
246import Browser.Navigation
249**All functions are no-ops in LynxJS.** They exist for API compatibility with elm/browser.
255Opaque navigation authority. Empty in LynxJS.
258pushUrl : Key -> String -> Cmd msg
259replaceUrl : Key -> String -> Cmd msg
260back : Key -> Int -> Cmd msg
261forward : Key -> Int -> Cmd msg
262load : String -> Cmd msg
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list