Name |
Description |
SK.App.LifeCycle( ) |
Constructor. |
lock() |
Tells the application management framework that the task is still processing |
unlock() |
Tells the application management framework that the task has been finished. |
failure( app_id, event_id ) |
Tells the application management framework that an error has occurred. |
Examples
Imagine here we are in the beginning of an application installation binding and this is some "install.htm" file:
<script type="text/javascript"> var MyApplication = new Class({ options: {}, initialize: function( options ) { this.options = options; // Tell the framework to wait new SK.App.LifeCycle( ).lock( ); // Run the installation this.install( ); }, install: function( ) { new SK.DB.Setup( this.options.session_id, { ...DB structure here... }, this.ready.bind( this ), this.failure.bind( this ) ); }, ready: function( structure ) { // We are ready with a successfully installed application new SK.App.LifeCycle( ).unlock( ); }, failure: function( message ) { // Oops, a failure. Notify the framework new SK.App.LifeCycle( ).failure( this.options.app_id, 'install' ); // Don't forget to unlock the UI new SK.App.LifeCycle( ).unlock( ); alert( message ); } }); </script> |