-
Notifications
You must be signed in to change notification settings - Fork 14
/
App.fs
41 lines (32 loc) · 2.71 KB
/
App.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
namespace GarbageApp
open Aardvark.UI
open Aardvark.UI.Generic
open Aardvark.UI.Primitives
open Aardvark.Base
open FSharp.Data.Adaptive
open System
module App =
let initial =
{
items = IndexList.ofList [ "foo"; "bar" ]
}
let rnd = new Random(0)
let update (model : Model) (msg : Message) =
match msg with
| Update _->
{ model with items = IndexList.ofList (List.init 5 (fun _ -> rnd.Next().ToString() )) }
let view (model : AdaptiveModel) =
div [clazz "ui inverted segment"; style "width: 100%; height: 100%"] [
Incremental.div (AttributeMap.ofList [clazz "button"]) (model.items |> AList.map (fun str ->
let garbage = Array.zeroCreate 10000000
div [ clazz "item"; onClick (fun _ -> Update(garbage))] str
))
]
let app =
{
unpersist = Unpersist.instance
threads = fun _ -> ThreadPool.empty
initial = initial
update = update
view = view
}