comment
WebSharper 4.1 is now available on NuGet, and as a vsix installer on the WebSharper website.
New and updated documentation: WebSharper 4.1 for C# and WebSharper 4.1 for F#.
See some new features live at Try WebSharper: in C# and in F#.
The release notes are also on GitHub.
New features
- Server-side event handlers and
ctx.ClientSidecan take any fixed F# quotation now and translates it to JavaScript. - New implementation for
WebSharper.Sitelets.Routertype, fully composable and also working on the client-side.WebSharper.UIadds helpers to use it for client-side routing. This allows generating safe links on the client for server-side endpoints, also on the server to states handled by the client.
See the details of Sitelet and Router features in the C# and F# documentation.
WebSharper.UI
WebSharper.UI.Nexthas been renamed toWebSharper.UI, affecting both package and namespace naming. For C# projects, an additional package reference forWebSharper.UI.CSharpis needed, and.CSharphas been removed from all namespace names, so now no extrausings are needed to get the C#-oriented extension methods. A compatibility packageWebSharper.UI.Next 4.1still exists for immediate back-compatibility, switching toWebSharper.UIis recommended for new features and fixes.- For composing HTML in F#, the
...Attrfamily of functions have been renamed to match just the name of the tag, while the previous functions taking no Attr list have been removed. So previousdiv [text "Hello"]becomesdiv [] [text "Hello"]withWebSharper.UI. - An nice and easy syntax is available for creating reactive values. If
xandyare bothVar<int>orView<int>thenV(x.V + x.Y)is eqivalent to usingView.Map2 (+). Also within F#textorAttr.functions and any C# HTML combinators, the logic forV(...)is applied automatically, so no extra wrapping is needed. - Template types (created either by the C# code generator or the F# type provider) have a new
.Varsproperty, exposing all the variables that has been bound to inputs in the template. If you specify no binding, aVarwill be implicitly created for the input. - The
IReftype has been removed andVaris now an abstract class.
See the details of UI features in the C# and F# documentation.
Fixes/improvements
- Fix using
<UseDownloadedResources>True</UseDownloadedResources>inweb.config, now local script links are correct for any sub-page. - Expanded
WebSharper.Testingto expose more equality test alternatives provided byQUnit. - Better handling of F# trait calls (using a member constraint inside an
inlinefunction). Now an overloaded method is resolved based on signature. - Optimization of remoting protocol: array of types are not included when it is empty.
Breaking changes
- Attributes previously in
WebSharper.Siteletsnamespace and assembly are now inWebSharpernamespace and inWebSharper.Core.dll. A
Sitelet'sRouterfield is now of typeIRouter, compatible in capabilities with the oldRouterrecord. The newRoutertype offers more combinators and is implementingIRouter.






