build/heimdallr-client.js
/**
 * Decorator that creates a function which will wait until the Client is
 * ready to to call the input <tt>fn</tt>. Any calls to the decorated function
 * will check if the client is ready. If it is ready, it will call
 * the function immediately. If it is not, it will add it to a
 * queue of callbacks that will be called once the Client is ready.
 * The client is ready once it has connected to the Heimdallr
 * server and received an 'auth-success' socket.io message.
 * 
 * @func onReady
 * @private
 * @arg {function} fn - Function to decorate.
 * @return {function} The decorated function that will postpone calls to it
 *     until the client is ready.
 */
Decorator that creates a function which will wait until the Client is
ready to to call the input fn. Any calls to the decorated function
will check if the client is ready. If it is ready, it will call
the function immediately. If it is not, it will add it to a
queue of callbacks that will be called once the Client is ready.
The client is ready once it has connected to the Heimdallr
server and received an 'auth-success' socket.io message.

@func onReady
@private
@arg {function} fn - Function to decorate.
@return {function} The decorated function that will postpone calls to it
until the client is ready.
Decorator that creates a function which will wait until the Client is ready to to call the input fn . Any calls to the decorated function will check if the client is ready . If it is ready it will call the function immediately . If it is not it will add it to a queue of callbacks that will be called once the Client is ready . The client is ready once it has connected to the Heimdallr server and received an ' auth - success ' socket . io message . @func onReady @private @arg { function } fn - Function to decorate . @return { function } The decorated function that will postpone calls to it until the client is ready .
function onReady(fn) {
    return function () {
        var client = this,
            args = Array.prototype.slice.call(arguments);
        if (client.ready) {
            fn.apply(client, args);
        } else {
            client.readyCallbacks.push(function () {
                fn.apply(client, args);
            });
        }
        return client;
    };
}
function onReady ( fn ) { return function ( ) { var client = this , args = Array . prototype . slice . call ( arguments ) ; if ( client . ready ) { fn . apply ( client , args ) ; } else { client . readyCallbacks . push ( function ( ) { fn . apply ( client , args ) ; } ) ; } return client ; } ; }
Decorator that creates a function which will wait until the Client is
 ready to to call the input <tt>fn</tt>.
Decorator that creates a function which will wait until the Client is ready to to call the input <tt > fn< / tt > .
// By assinging `this` to client, we can force this scope to be // preserved. Otherwise, if the client isn't ready and the function // gets pushed onto `readyCallbacks`, `this` will be the global object // when the `readyCallbacks` are finally called.