Handling VirtualUI Events

The following example shows how to assign handlers to events available in the VirtualUI object (they can be seen in the javascript console or shown as alerts in the case of errors or disconnections)

<!DOCTYPE html>
<html>
<head>
 <title>Thinfinity VirtualUI - Basic Page</title>
 <link rel="stylesheet" type="text/css" href="css/thinfinity.virtualui.css" />
 <script src="virtualui.sdk.min.js" type="text/javascript"></script>
</head>
<body>
 <script type="text/javascript">
 $(document).ready(function () {
 var virtualUI = new Thinfinity.VirtualUI();
 virtualUI.onError = function (errorMsg) {
 if (errorMsg == null) { errorMsg = ""; }
 alert("Application load failed: " + errorMsg);
 };
 virtualUI.onLoading = function () {
 console.log("Loading...");
 };
 virtualUI.onShow = function () {
 console.log("Application loaded.");
 };
 virtualUI.onClose = function () {
 alert("Application closed.");
 window.close();
 };
 virtualUI.connect();
 });
 </script>
 <div id="virtualui" style="position:absolute;display:none;"></div>
</body>
</html>

Thinfinity.jsRO Class

The Thinfinity.jsRO class helps create interaction between the application and the web that's much more fluid than any other methodology or standard technology available.

This class interacts with the executable file and accesses the data models that are exposed from the application and the properties, methods and events that have been written for each of these models.

In the next chapter we will see how to work with jsRO (Javascript Remote Objects).

Read more:

· Advanced Programming with jsRO

Last updated