Closed Jand42 closed 10 months ago
Can you add some pseudo code for what this would look like for each Web.Control
?
For normal Web.Controls, we can generate startup code like this:
DecodeJson_MyControl({ ... data ...}).Body.ReplaceInDom(document.getElementById("ControlID"))
For InlineControls, we need custom deserializing where we can pass import/imports, maybe new Interface IImportingControl, so we know at runtime easily, however, we need static method for client-side instantiation
MyInlineControl.Decode({ ... data ...}, funcImport, dataDeserializers...).Body.ReplaceInDom(document.getElementById("ControlID"))
And for IInitializer, we need to instantiate it and call the 3 methods in right order:
let x = DecodeJson_MyInitializer({ ... data ... })
x.PreInitialize("ControlID")
//...
x.Initialize("ControlID")
//...
x.PostInitialize("ControlID")
RPCs now use the symmetric (no type tags) JSON format for remoting: #930
Same format could be used for
Web.Control
initialization - passing down data from the server to client to set up the page. This would make current dynamicWebSharper.Json.Activate
deprecated. For WS7, this already gets all necessary type constructors passed down to it from the startup code snippet generated by Sitelets runtime. This piece could be simplified if compiler pre-generates the JSON de-serialization and DOM replacement function for eachWeb.Control
type.