lib/altshift/application.js
function register(app) {
    //Check if registered twice
    if (applicationCurrent === app) {
        return;
    }

    //Only one application can be registered
    if (applicationCurrent) {
        throw new core.Error({
            code: 'application-registered',
            message: 'An application was already registered'
        });
    }

    //Set all handlers
    Interface.ensure(app, IApplication);
    applicationCurrent = app;

    currentHandlers.SIGINT = function () {
        console.log('Application interrupted');
        app.exit();
    };

    /*
     FIXME: Eclipse bug
     currentHandlers.SIGTERM = function () {
        console.log('Killing in the name of!');
        unregister();
        process.exit();
    };*/

    currentHandlers.uncaughtException = function (error) {
        app.handleError(error);
    };

    currentHandlers.exit = function () {
        exports.unregister();
    };

    EVENTS.forEach(function (event) {
        if (currentHandlers[event]) {
            process.on(event, currentHandlers[event]);
        }
    });

    //Start application
    applicationCurrent.start();
}
function register(app) {
    //Check if registered twice
    if (applicationCurrent === app) {
        return;
    }

    //Only one application can be registered
    if (applicationCurrent) {
        throw new core.Error({
            code: 'application-registered',
            message: 'An application was already registered'
        });
    }

    //Set all handlers
    Interface.ensure(app, IApplication);
    applicationCurrent = app;

    currentHandlers.SIGINT = function () {
        console.log('Application interrupted');
        app.exit();
    };

    /*
     FIXME: Eclipse bug
     currentHandlers.SIGTERM = function () {
        console.log('Killing in the name of!');
        unregister();
        process.exit();
    };*/

    currentHandlers.uncaughtException = function (error) {
        app.handleError(error);
    };

    currentHandlers.exit = function () {
        exports.unregister();
    };

    EVENTS.forEach(function (event) {
        if (currentHandlers[event]) {
            process.on(event, currentHandlers[event]);
        }
    });

    //Start application
    applicationCurrent.start();
}
function register ( app ) { //Check if registered twice if ( applicationCurrent === app ) { return ; } //Only one application can be registered if ( applicationCurrent ) { throw new core . Error ( { code : 'application-registered' , message : 'An application was already registered' } ) ; } //Set all handlers Interface . ensure ( app , IApplication ) ; applicationCurrent = app ; currentHandlers . SIGINT = function ( ) { console . log ( 'Application interrupted' ) ; app . exit ( ) ; } ; /*
     FIXME: Eclipse bug
     currentHandlers.SIGTERM = function () {
        console.log('Killing in the name of!');
        unregister();
        process.exit();
    };*/ currentHandlers . uncaughtException = function ( error ) { app . handleError ( error ) ; } ; currentHandlers . exit = function ( ) { exports . unregister ( ) ; } ; EVENTS . forEach ( function ( event ) { if ( currentHandlers [ event ] ) { process . on ( event , currentHandlers [ event ] ) ; } } ) ; //Start application applicationCurrent . start ( ) ; }
Register app as the current executing application.
This will also register all error handler for uncaught exceptions

@param {Application} app
@return undefined
Register app as the current executing application . This will also register all error handler for uncaught exceptions