Creating jsRO Objects
As stated previously, the jsRO models are created in the application and then propagated to the browser, where they can be consumed from JavaScript through a Thinfinity.JsRO class instance.
Let’s see a complete example of this sequence.
Both examples create an ro object, which has a text property with the value “Hello!”.
Using Delphi, in the Create method of the form:
// Creates the remote object and its property
ro := TJSObject.Create('ro');
ro.Properties.Add('text');
ro.ApplyModel;
Using C# (.Net Winform application)
// Creates the remote object and its property
ro = new JSObject("ro");
ro.Properties.Add("text");
ro.ApplyModel();
Let’s see how to work with this object from Javascript:
$(document).ready(function () {
// ...
var jsro = new Thinfinity.JsRO();
var ro = null;
// ...
jsro.on('model:ro', 'created', function () {
ro = jsro.model.ro;
});
});
Sequence diagram for the creation of an object:
