@Jand42 Jand42 released this Jan 9, 2018 · 373 commits to master since this release

Assets 2

WebSharper 4.1.1.175

New features

  • #853 Server-side event handlers (on.*) and ClientSide can take any fixed F# quotation now and translates it to JavaScript. (Announced for 4.1 erroneously, now included)
div [] [ text "div created on the server" ]
client 
    <@ JavaScript.Console.Log "running client-side code"
       div [] [ text "div created on the client" ]
    @>
  • #730 The IsClient value (WebSharper.Pervasives.IsClient from C#) and their negations (not IsClient and !Pervasives.IsClient) can be used as a condition in branching logic in shared client-server code to make the JavaScript compiler skip the false branch entirely.
    // using WebSharper;
    if (Pervasives.IsClient) { ClientSideMethod(); } else { ServerSideMethod(); }
    var res = Pervasives.IsClient ? ClientSideMethod() : ServerSideMethod();
    if IsClient then ClientSideMethod() else ServerSideMethod()

Fixes/improvements

  • #869 an empty F# Map passed to an RPC function is deserialized correctly.
  • #879 The behavior of the Stub attribute on constructors and static methods are now consistent with the documented translation logic since WebSharper 3.0.
  • #875 Multiple server-side event handlers and ClientSide having captured arguments within the same method do not interfere with each other.
  • #880 The client helper in WebSharper.UI is now available again within client-side code. So a div [] [ client <@ div [] [] @> ] in server side-code will create the internal div on the client (the server returning a placeholder) while fully running on the it just creates the internal div basically as if client <@ @> wrapper was not there.
  • #881 Server-side event handlers and ClientSide do not create extra functions in translated JavaScript code if their expression is containing a single static method call. These functions in back-compatibility package WebSharper.UI.Next work the same as in WebSharper 4.0.