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.ClientSide
can take any fixed F# quotation now and translates it to JavaScript. - New implementation for
WebSharper.Sitelets.Router
type, fully composable and also working on the client-side.WebSharper.UI
adds 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.Next
has been renamed toWebSharper.UI
, affecting both package and namespace naming. For C# projects, an additional package reference forWebSharper.UI.CSharp
is needed, and.CSharp
has been removed from all namespace names, so now no extrausing
s are needed to get the C#-oriented extension methods. A compatibility packageWebSharper.UI.Next 4.1
still exists for immediate back-compatibility, switching toWebSharper.UI
is recommended for new features and fixes.- For composing HTML in F#, the
...Attr
family 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
x
andy
are bothVar<int>
orView<int>
thenV(x.V + x.Y)
is eqivalent to usingView.Map2 (+)
. Also within F#text
orAttr.
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
.Vars
property, exposing all the variables that has been bound to inputs in the template. If you specify no binding, aVar
will be implicitly created for the input. - The
IRef
type has been removed andVar
is 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.Testing
to expose more equality test alternatives provided byQUnit
. - Better handling of F# trait calls (using a member constraint inside an
inline
function). 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.Sitelets
namespace and assembly are now inWebSharper
namespace and inWebSharper.Core.dll
. A
Sitelet
'sRouter
field is now of typeIRouter
, compatible in capabilities with the oldRouter
record. The newRouter
type offers more combinators and is implementingIRouter
.