app.js

App.js is a javascript file distributed in the Thinfinity VirtualUI installation. Its purpose is to allow the user to modify some of the application web behaviour.

The file contains the code needed to interact with the VirtualUI objects:

var virtualUI = null; var splash = null;

$(document).ready(function () { splash = new Splash(); virtualUI = new Thinfinity.VirtualUI(); virtualUI.onError = function (errorMsg) { if (errorMsg == null) { errorMsg = ""; } splash.show("Application load failed", errorMsg, false, false); }; virtualUI.onLoading = function () { if (virtualUI.devMode) { splash.show("Waiting for application ...", "", true, false); } else { splash.show("Loading...", "", true, false); } }; virtualUI.onShow = function () { splash.hide(); }; virtualUI.onClose = function (url) { // -- The url argument is used to enable going back to a specific page, when virtualPath is used and url is not null. if ((typeof url != 'undefined') && (url != '') && (url != null)) { // tries to close the window.top if ((virtualUI.devMode != true) || (window.top.opener)) { window.top.close(); } window.top.location.href = url; return; } // if in devMode, reload the page if (virtualUI.devMode) { location.reload(); }

// tries to close the window/tab if ((virtualUI.devMode != true) || (window.opener)) { window.close(); }

// else returns to the calling page

if ((window.top == window) && (document.referrer) && (location.href != document.referrer)) { location.href = document.referrer; } // else shows the splash else { splash.show("Application closed", "", false, false); }

}; // Remove or comment this event to prevent onUnload message prompt. virtualUI.onBeforeUnload = function () { return "You are about to close the application."; } // -- Connect to server...

// -- "ClientSettings" values are used during the start of the connection and then are no longer taken into account, only used as query.

// -- Set values or leave as default. virtualUI.clientSettings = {

// -- Leave as default, server rules (Is not necessary to assign value).

//'CursorVisible': null,

//'MouseMoveGestureStyle': null,

//'MouseMoveGestureAction': null,

// -- Set default values, JS rules.

'UseViewportSize': false,

'DockMenu': {

'Enabled': true,

'Pinned': true,

'Items': {

'WindowList': true,

'ErrorReporting': true,

'BrowserCapabilities': true,

'Keyboard': true,

'Fullscreen': true

}

}

};

// -- Or

////virtualUI.clientSettings.CursorVisible = null;

////virtualUI.clientSettings.MouseMoveGestureStyle = null;

////virtualUI.clientSettings.MouseMoveGestureAction = null;

//// -- Set default values, JS rules.

//virtualUI.clientSettings.DockMenu.Enabled = false;

//virtualUI.clientSettings.DockMenu.Items.WindowList = false;

//virtualUI.clientSettings.DockMenu.Items.ErrorReporting= false;

//virtualUI.clientSettings.DockMenu.Items.BrowserCapabilities = false;

//virtualUI.clientSettings.DockMenu.Items.Keyboard = false;

//virtualUI.clientSettings.DockMenu.Items.Fullscreen = false;

virtualUI.connect(); });

Handling VirtualUI Events

onError

This event is triggered when an error is produced in the communication or inside the VirtualUI obejct.

onLoading

This event is triggered when the page is loaded, before the onShow event.

onShow

This event is triggered when information from the published application starts to arrive.

onClose

This event is triggered when the application is closed.

onBeforeUnload

Returns the message created in the new public event of the VirtualUI class. onBeforeUnload

Remove or comment this event to prevent onUnload message prompt.

connect

This method starts the communication against the VirtualUI server.

Last updated