extension/location.js
function (appID, locationID) {

    // check if location exists
    if (l_locations.hasOwnProperty(locationID) === false) {
        LOG.error('locationID: ' + locationID + ' does not exist', 'addApp');
        return;
    }

    // check if already exists, ignore action if already exists
    if (l_apps.hasOwnProperty(appID) === true) {
        LOG.error('appID: ' + appID + ' already exists', 'addApp');
        return;
    }

    // insert new app record for this location
    l_apps[appID] = {
        locationID: locationID,
        users: {}
    }

    // build mapping from location to app 
    // TODO: (needed? or can simplfiy?)
    l_locations[locationID].apps[appID] = l_apps[appID];    
}
function (appID, locationID) {

    // check if location exists
    if (l_locations.hasOwnProperty(locationID) === false) {
        LOG.error('locationID: ' + locationID + ' does not exist', 'addApp');
        return;
    }

    // check if already exists, ignore action if already exists
    if (l_apps.hasOwnProperty(appID) === true) {
        LOG.error('appID: ' + appID + ' already exists', 'addApp');
        return;
    }

    // insert new app record for this location
    l_apps[appID] = {
        locationID: locationID,
        users: {}
    }

    // build mapping from location to app 
    // TODO: (needed? or can simplfiy?)
    l_locations[locationID].apps[appID] = l_apps[appID];    
}
function ( appID , locationID ) { // check if location exists if ( l_locations . hasOwnProperty ( locationID ) === false ) { LOG . error ( 'locationID: ' + locationID + ' does not exist' , 'addApp' ) ; return ; } // check if already exists, ignore action if already exists if ( l_apps . hasOwnProperty ( appID ) === true ) { LOG . error ( 'appID: ' + appID + ' already exists' , 'addApp' ) ; return ; } // insert new app record for this location l_apps [ appID ] = { locationID : locationID , users : { } } // build mapping from location to app  // TODO: (needed? or can simplfiy?) l_locations [ locationID ] . apps [ appID ] = l_apps [ appID ] ; }
add a new app
add a new app