Platform Package reference: Function _GetExistingAutoObject()

Description of the function _GetExistingAutoObject() available in all Platform Packages for WebGL JavaScript compatible target systems starting with version 15 of Embedded Wizard. This function is intended to be used when integrating the Embedded Wizard created GUI application with the underlying graphics subsystem, graphics hardware or other external GUI applications coexisting on the same system. Unlike _GetAutoObject(), this function does not instantiate the autoobject if it does not already exist.

Declaration

function _GetExistingAutoObject( aAutoObject )

Parameters

aAutoObject

Data structure representing the autoobject to access. This data structure and all associated contents are generated by Embedded Wizard.

Discussion

The function _GetExistingAutoObject() returns an autoobject identified by aAutoObject if it is currently instantiated, or returns null if no instance exists. The function verifies whether the required object is already instantiated and if it's true, the existing instance is returned immediately. If no instance of the desired autoobject could be found, _GetExistingAutoObject() returns null without creating a new object. For example:

var device = EmWiApp._GetExistingAutoObject( EmWiApp.Application.DeviceObject ); if ( device !== null ) { // The autoobject exists - feed event to it // ... }

This function is particularly useful for middleware implementations where middleware events or data should only be fed to the UI when the UI maintains the corresponding autoobject alive. By checking for the existence of the autoobject without triggering its instantiation, middleware can avoid unnecessarily creating objects and can respond appropriately when the UI component is not active.

If you need to ensure the autoobject is instantiated, use _GetAutoObject() instead, which will create the object if it does not already exist.