performTransition()

Description:

The performTransition method operates as a screen update command, which tells the widget UI framework to update the widget screen. It performs the animation while the widget's view is being changed. Currently, only fading animation mode is supported.

The performTransition method is to be called together with the prepareForTransition method.

Syntax:

[void] widget.performTransition(void) 

or

[void] window.widget.performTransition(void)

Arguments:

This method does not take any arguments.

Return value:

This method does not return a value.

Example code:

Example HTML code:

<!-- Main view -->
<div id='main'>
  Hello World!
  <input type="button" value="Config" onclick="toMain(0);" />
</div>
<!-- Main view ends -->
<!-- Config view -->
<div id='config'>
  Your world is my world!
  <input type="button" value="Main" onclick="toMain(1);" />
</div>
<!-- Settings view ends -->

Example JavaScript code:

function toMain(main) {
  // preparing for Transition
  widget.prepareForTransition("fade");
  if (main) { // switching from config view to the main view
    // hide config view
    document.getElementById("config").style.display = 'none';
    // show main view
    document.getElementById("main").style.display = 'block';
    }
  else {  // switching from main view to config view
    // hide main view
    document.getElementById("main").style.display = 'none';
    // show config view
    document.getElementById("config").style.display = 'block';
    }
  // do the Transition to make the fade effect
  widget.performTransition();
}