Skip to content

Commit

Permalink
Fix #163: add proxy for quotation-based on.afterRender
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmil committed Mar 29, 2018
1 parent 9fafe9e commit 7eeccc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions WebSharper.UI/Attr.Client.fs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ type AttrProxy with
Array.ofSeqNonCopying xs
|> Array.TreeReduce Attr.Empty Attr.Append

static member OnAfterRenderImpl(q: Expr<Element -> unit>) =
As<Attr> (A4 (As q))

static member HandlerImpl(event: string, q: Expr<Element -> #DomEvent-> unit>) =
As<Attr> (Attrs.Static (fun el -> el.AddEventListener(event, (As<Element -> DomEvent -> unit> q) el, false)))

Expand Down
2 changes: 2 additions & 0 deletions WebSharper.UI/HTML.Proxy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ open WebSharper.UI

[<Proxy(typeof<Html.on>)>]
type private onProxy =
[<JavaScript; Inline>]
static member afterRender (f: Expr<Dom.Element -> unit>) = Attr.OnAfterRenderImpl(f)
// {{ event
[<JavaScript; Inline>]
static member abort (f: Expr<Dom.Element -> Dom.UIEvent -> unit>) = Attr.HandlerImpl("abort", f)
Expand Down

0 comments on commit 7eeccc1

Please sign in to comment.