OL Learn

document.addEventListener("deviceready"


#1

Working with COTG specifically on a iPad, but I suspect that it would be the same for any device. In the COTG-1.2.1.js file, when does this function execute?

/***************************************************************************
 * Get the current COTG loginIdentifier (user account)
 */
function UserAccount($element) {
    var that = this;
    that.object = $element;

    document.addEventListener("deviceready", function() {
        that.object.val(navigator.cotgHost.loginIdentifier);
    });
}

UserAccount.init = function($element) {
    $('[role="cotg.UserAccount"]', $element).each(function() {
        widgets.push(new UserAccount($(this)));
    });
};

Would the document be fully opened so that the document could be deleted from the repository, or would this just indicate that the document has been downloaded to My library, but not opened?


#2

It will be executed once the COTG document is open and the “connexion” between the COTG/Cordova javascript and the device hardware is done.