src/courier/PostMessageChannel.js
function postMessage(message, target, force) {
            var consumer;
            var parsed;

            if (!this.disposed) {
                try {
                    if (message) {
                        if (this.ready || force) {
                            // Post the message
                            consumer = target || this.receiver;
                            parsed = _prepareMessage.call(this, message);
                            consumer.postMessage(parsed);
                            return true;
                        }
                        else if (this.maxConcurrency >= this.messageQueue.length) {
                            // Need to delay/queue messages till target is ready
                            this.messageQueue.push(message);
                            return true;
                        }
                        else {
                            return false;
                        }
                    }
                }
                catch(ex) {
                    /* istanbul ignore next  */
                    PostMessageUtilities.log("Error while trying to post the message", "ERROR", "PostMessageChannel");
                    return false;
                }
            }
        }
function postMessage(message, target, force) {
            var consumer;
            var parsed;

            if (!this.disposed) {
                try {
                    if (message) {
                        if (this.ready || force) {
                            // Post the message
                            consumer = target || this.receiver;
                            parsed = _prepareMessage.call(this, message);
                            consumer.postMessage(parsed);
                            return true;
                        }
                        else if (this.maxConcurrency >= this.messageQueue.length) {
                            // Need to delay/queue messages till target is ready
                            this.messageQueue.push(message);
                            return true;
                        }
                        else {
                            return false;
                        }
                    }
                }
                catch(ex) {
                    /* istanbul ignore next  */
                    PostMessageUtilities.log("Error while trying to post the message", "ERROR", "PostMessageChannel");
                    return false;
                }
            }
        }
function postMessage ( message , target , force ) { var consumer ; var parsed ; if ( ! this . disposed ) { try { if ( message ) { if ( this . ready || force ) { // Post the message consumer = target || this . receiver ; parsed = _prepareMessage . call ( this , message ) ; consumer . postMessage ( parsed ) ; return true ; } else if ( this . maxConcurrency >= this . messageQueue . length ) { // Need to delay/queue messages till target is ready this . messageQueue . push ( message ) ; return true ; } else { return false ; } } } catch ( ex ) { /* istanbul ignore next  */ PostMessageUtilities . log ( "Error while trying to post the message" , "ERROR" , "PostMessageChannel" ) ; return false ; } } }
Method to post the message to the target
@param {Object} message - the message to post
@param {Object} [target] - optional target for post
@param {Boolean} [force = false] - force post even if not ready
Method to post the message to the target