Lates WebSharper 4 beta has compiler and output optimizations, auto-versioning scripts.
Latest Visual Studio template installers compatible with VS2015/2017 is available here.
WebResource
, use this hash on generating links to avoid browsers caching an outdated version. This is an automatic feature, no configuration currently.Serializable
attribute and default constructor are not required as on the server.)new JSObject() { { "background-color", "#666" } }
.apply
and array .concat
to reduce translated code size and make it more readable.WebSharper.TypedJson
from C# to avoid name conflict.JavaScript(false)
on an interface opts-out of default interface handling on client-side, allows for more divergence of client/server behavior when needed.There is an inconvenient source of memory leaks in most JavaScript engines: captured variables are tied to a Context object and even functions that do not use some (or any) variables from a Context still retain the whole object. This is described well here.
Adding a
WebSharperAnalyzeClosures
project property gives warnings on these kinds of captures, helping to eliminate memory leaks.Usage:
<WebSharperAnalyzeClosures>True</WebSharperAnalyzeClosures>
or<WebSharperAnalyzeClosures>MoveToTop</WebSharperAnalyzeClosures>
. The latter additionally moves all non-capturing lambdas to top level automatically (experimental).
[<Inline "myLibrary.doSomething()">]
and [<Inline "$global.myLibrary.doSomething()">]
was working equivalently. Now access to global scope without the $global
object is assumed to be initialized before the current script starts running (WebSharper itself takes care of this, if you use the Require
attribute) and will not change, so it is safe to shorten. Whenever you want the exact call on the current global scope (window
object), be sure to use $global
.Can’t find what you were looking for? Drop us a line.