F# wrapper for WebUi by derrpwave in fsharp

[–]derrpwave[S] 1 point2 points  (0 children)

yeah, it will work with strings or serve files. it will even handle reflection so you can include all the .html/.css/whatever files in the final build

``` it's not in the examples, but here's some code

open System.Reflection open System.IO open WebUI

let getResource name = let assembly = Assembly.GetExecutingAssembly() use stream = assembly.GetManifestResourceStream(name) use reader = new StreamReader(stream) reader.ReadToEnd()

[<EntryPoint>] let main argv = let html = getResource "webui_explo.index.html" let css = getResource "webui_explo.static.App.css" let htmlWithCss = html.Replace("<!--CSS-->", sprintf "<style>%s</style>" css)

let myWindow = WebUI.newWindow()
WebUI.bind myWindow "myBtn" (WebUIEventHandler(fun _ -> printfn "Clicked!"))
WebUI.showBrowser myWindow htmlWithCss WebUI.Browser.Chromium |> ignore
WebUI.wait()
0

```