Name

Description

SK.App.LifeCycle( )

Constructor.

The library should be executed only during the "lifecycle" bindings execution — install, deinstall, update.

The library makes sense when it executes asynchronously some tasks and the installer console doesn't know if the task has been completed or not. The library allows the application to explicitly "lock" the screen in the management console (Control Panel > Applications) and "unlock" it after the task has been finished.

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>