ServerConfiguration/Calla/Calla-Lib/game/src/Game.js
/**
     * Find a user by id, then perform an operation on it.
     * @param {string} msg
     * @param {string} id
     * @param {withUserCallback} callback
     * @param {number} timeout
     */
Find a user by id, then perform an operation on it.
Find a user by id then perform an operation on it .
withUser(msg, id, callback, timeout) {
        if (timeout === undefined) {
            timeout = 5000;
        }
        if (id) {
            if (this.users.has(id)) {
                const user = this.users.get(id)
                callback(user);
            }
            else {
                console.warn(`No user "${id}" found to ${msg}. Trying again in a quarter second.`);
                if (timeout > 0) {
                    setTimeout(this.withUser.bind(this, msg, id, callback, timeout - 250), 250);
                }
            }
        }
    }
withUser ( msg , id , callback , timeout ) { if ( timeout === undefined ) { timeout = 5000 ; } if ( id ) { if ( this . users . has ( id ) ) { const user = this . users . get ( id ) callback ( user ) ; } else { console . warn ( ` ${ id } ${ msg } ` ) ; if ( timeout > 0 ) { setTimeout ( this . withUser . bind ( this , msg , id , callback , timeout - 250 ) , 250 ) ; } } } }
Find a user by id, then perform an operation on it.
Find a user by id then perform an operation on it .