New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method name not found in JavaScript compilation #166

Closed
AndreiDegtiarev opened this Issue Mar 31, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@AndreiDegtiarev

AndreiDegtiarev commented Mar 31, 2018

After migration from Websharper.UI.Next to Websharper.UI, the code

let Main () = (div[] []).OnMouseDown(fun _ _ ->()) 

yields the build error:

error FS9001: Method name not found in JavaScript compilation: (OnMouseDown : Microsoft.FSharp.Quotations.FSharpExpr`1<(WebSharper.JavaScript.Dom.Element -> (WebSharper.JavaScript.Dom.MouseEvent -> unit))> -> WebSharper.UI.Elt), Members: get_Element, AddClass', ClearHoles, AddHole, onExpr, SetStyle', HasClass', RemoveClass', GetProperty', SetProperty', RemoveAttribute', HasAttribute', GetAttribute', SetAttribute', SetText, GetText, SetValue, GetValue, Id', Html', Clear', PrependDoc, AppendDoc, TreeNode, New, ToUpdater, OnAfterRenderView, OnAfterRender, onView, on
@granicz

This comment has been minimized.

Member

granicz commented Mar 31, 2018

I believe the update to UI didn't go correctly in your project - the above code should still work just fine. You might want to remove all UI.Next references (confirming in the project files as well) and re-adding the UI ones.

@Tarmil

This comment has been minimized.

Member

Tarmil commented Apr 2, 2018

Actually I think this is because we are missing proxies for the quotation-based version of these methods. We should definitely (re-?)add them. But in the meantime, you should use open WebSharper.UI.Client to bring the client-side only, non-quotation-based method.

@Tarmil Tarmil closed this in da5d43f Apr 3, 2018

@AndreiDegtiarev

This comment has been minimized.

AndreiDegtiarev commented Apr 3, 2018

Could you please point me how I can use “WebSharper.UI.Client” for handling of mouse events?

@RobBarton

This comment has been minimized.

RobBarton commented Apr 4, 2018

I encountered the same problem during a 3 -> 4 upgrade. This might work for you:
let Main () = DocExtensions.OnMouseDown (div [] [], fun _ _ -> ())

@Tarmil

This comment has been minimized.

Member

Tarmil commented Apr 4, 2018

Or you can set the event handler as an attribute:

let Main () =
    div [ on.mouseDown (fun _ _ -> ()) ] []
@AndreiDegtiarev

This comment has been minimized.

AndreiDegtiarev commented Apr 4, 2018

Thank you for the help. It works now.

@Tarmil Tarmil added the 4.2.5.115 label Apr 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment