comment
Today we just pushed out our release candidate for WebSharper 3.0. This means that WebSharper 3.0 is now in feature freeze, and we will only be releasing bug fixes until the stable release of WebSharper. So if you were holding out on switching to 3.0 because of continuous breaking changes, now is the time to try it out!
WebSharper 3.0-rc1 is available for download right now.
We also made large enhancements to the online documentation; check out the sections on Sitelets, HTML combinators, WIG and UI.Next. More will be coming until the stable release.
Change log
Here is the list of changes:
Homogenize
WebSharper.Html.Client,WebSharper.Html.ServerandWebSharper.UI.Next.Html: the HTML combinators are now generated from a list of standard HTML tag names and attributes, to ensure consistency between the client and server libraries.#337: Exception when building WebSharper itself in debug mode.
- Html.Client:
- Mouse and keyboard events have an
Eventfield to access the underlyingDom.Event. Add
OnEventto bind a custom event by name.
- Mouse and keyboard events have an
- UI.Next:
Docnow implementsWebSharper.Web.IControlBody. This means that it can be used directly as theBodyof aWeb.Control:1 2 3 4 5 6 7 8 9 10 11
type MyControl() = inherit Web.Control() [<JavaScript>] override this.Body = let rvText = Var.Create "" Doc.Concat [ Doc.Input rvText Label [] [Doc.TextView rvText.View] ] :> _
- JQuery:
Make the types of
.on(),.off()and.one()more consistent with other event handlers such as.click(), passing the element and the event to the callback and returning theJQuery:1 2 3 4
JQuery.Of("#my-input") .On("paste", fun el ev -> JS.Alert ("Text pasted, value is now: " + JQuery.Of(el).Val())) .Ignore- Add
Event.AsDomEvent. Fix
JQuery.GetJSONinline.
- WebSharper.JavaScript:
- Sitelets:
- Remoting:
- WIG:
- Removed access modifiers, as only public makes sense in a WIG definition anyway.
- Deprecated
Type.New(). It was mainly used for two purposes:- Self-reference: you can use
TSelfinstead. Mutually recursive types: the recommended way is to name classes first and add members later:
1 2 3 4 5 6 7 8 9 10 11
let Chicken' = Class "Chicken" let Egg = Class "Egg" |+> Instance [ "hatch" => T<unit> ^-> Chicken' ] let Chicken = Chicken' |+> Instance [ "lay" => T<unit> ^-> Egg ]
- Self-reference: you can use
Added
Pattern.RequiredFields,Pattern.OptionalFieldsandPattern.ObsoleteFieldsto create configuration objects in a more compositional way:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// Existing Pattern.Config: let MyConfig : Class = Pattern.Config "classname" { Required = [ "name", T<string> ] Optional = [ "width", T<int> "height", T<int> ] } // New API: let MyConfig : Class = Class "classname" |+> Pattern.RequiredFields [ "name", T<string> ] |+> Pattern.OptionalFields [ "width", T<int> "height", T<int> ]
Future plans
This release candidate means that the 3.0 stable will be coming soon. In fact, unless a big issue holds us up, we will be releasing WebSharper 3.0 as early as next week.
After that, here is a peek at what you can expect from future releases:
- TypeScript declarations: we will be stabilizing the support for outputting
.d.tsdeclarations for generated JavaScript modules, which was an experimental feature so far. - F# 4.0 support: as soon as F# 4.0 is finalized, we will provide proxies for the extended standard library.
- Source mapping: we will improve the support for source maps, in particular reduce the need for many-to-many mapping which several browsers have trouble with.
Happy coding!






