Handle framework messages
@param {string} name The name of the message
@param {Object} data The related data for the message
@returns {void}
169522
function (name, data) {
            switch (name) {
                case 'beforezoom':
                    this.handleBeforeZoom(data);
                    break;
                case 'pageavailable':
                    this.handlePageAvailable(data);
                    break;
                case 'pagefocus':
                    this.handlePageFocus(data);
                    break;
                case 'ready':
                    this.handleReady();
                    break;
                case 'scroll':
                    this.handleScroll();
                    break;
                case 'scrollend':
                    this.handleScrollEnd();
                    break;
                case 'zoom':
                    this.handleZoom(data);
                    break;
                // no default
            }
        }
30279
function (name, data) {
            switch (name) {
                case 'layoutchange':
                    api.updateLayout();
                    break;

                case 'linkclick':
                    handleLinkClick(data);
                    break;

                case 'zoom':
                    // artificially adjust the reported zoom to be accuate given the page scale
                    data.zoom *= config.pageScale;
                    data.prevZoom *= config.pageScale;
                    if (config.enableDragging) {
                        updateDragger(data.isDraggable);
                    }

                    // forward zoom event to external event handlers
                    api.fire(name, data);
                    break;

                case 'dragstart':
                    if (!$el.hasClass(CSS_CLASS_DRAGGING)) {
                        $el.addClass(CSS_CLASS_DRAGGING);
                    }
                    // forward zoom event to external event handlers
                    api.fire(name, data);
                    break;

                case 'dragend':
                    if ($el.hasClass(CSS_CLASS_DRAGGING)) {
                        $el.removeClass(CSS_CLASS_DRAGGING);
                    }
                    // forward zoom event to external event handlers
                    api.fire(name, data);
                    break;

                default:
                    // forward subscribed framework messages to external event handlers
                    api.fire(name, data);
                    break;
            }
        }
213347
public void addBroadcastSetForMessagingFunction(String name, DataSet<?> data) {
		this.bcVarsMessaging.add(new Tuple2<String, DataSet<?>>(name, data));
	}
91493
function handleMessageFromMainThread(message) {
    var kind = message.data.kind;
    var payload = message.data.payload;

    if (kind === messageKind.init) {
      graph = fromjson(payload.graph);
      var options = JSON.parse(payload.options);

      init(graph, options);
    } else if (kind === messageKind.step) {
      step();
    } else if (kind === messageKind.pinNode) {
      pinNode(payload.nodeId, payload.isPinned);
    } else if (kind === messageKind.setNodePosition) {
      setNodePosition(payload.nodeId, payload.x, payload.y, payload.z);
    }
    // TODO: listen for graph changes from main thread and update layout here.
  }
409699
private void handleOutboundMimeMessageHeader(final org.springframework.ws.soap.SoapMessage message,
                                                 final String name,
                                                 final Object value,
                                                 final boolean handleMimeHeaders) {
        if (!handleMimeHeaders) {
            return;
        }

        if (message instanceof SaajSoapMessage) {
            final SaajSoapMessage soapMsg = (SaajSoapMessage) message;
            final MimeHeaders headers = soapMsg.getSaajMessage().getMimeHeaders();
            headers.setHeader(name, value.toString());
        } else if (message instanceof AxiomSoapMessage) {
            log.warn("Unable to set mime message header '" + name + "' on AxiomSoapMessage - unsupported");
        } else {
            log.warn("Unsupported SOAP message implementation - unable to set mime message header '" + name + "'");
        }
    }
748229
public function messages($name)
    {
        if ($this->hasMessagesFor($name)) {
            foreach ($this->getMessagesFor($name) as $message) {
                $this->flash->error($message);
            }
        }
    }
744688
function (name) {
                /**
                 * Any of the allowed functions. Arguments are shifted if params is a function so there's no need to give an empty params array.
                 * @param {Array} params optional array of parameters for the function. Treated as success callback if a function instead.
                 * @param {function} success Callback function
                 * @param {function} error   Error handler
                 */
                RPC_API[name] = function (params, success, error) {
                    if (name === 'getInfo') {
                        // hide params from external getInfo calls
                        error = success;
                        success = params;
                        params = [rpcClientVersion];
                    }

                    if (typeof params === 'function') {
                        error = success;
                        success = params;
                        params = [];
                    }

                    channel.call({
                        method: name,
                        params: params,
                        success: success,
                        error: error || defaultErrorHandler
                    });
                };
            }
194154
function handleForName(name) {
    assert(typeof name == 'string', 'name must be a string')
    return osa(name => {
        const Messages = Application('Messages')
        return Messages.buddies.whose({ name: name })[0].handle()
    })(name)
}
652207
async function sendMessage({name, message}) {
  return _makeSimulatedNetworkRequest((resolve, reject) => {
    const chatForName = backendStateForLoggedInPerson.chats.find(
      chat => chat.name === name
    );
    if (chatForName) {
      chatForName.messages.push({
        name: 'Me',
        text: message,
      });
      resolve();
    } else {
      reject(new Error('Uknown person: ' + name));
    }
  });
}
1344047
function handleMessages(event) {
  if (!isAllowed()) return;
  if (!event || event.source !== window || typeof event.data !== 'object') return;
  const message = event.data;
  if (message.source !== pageSource) return;
  if (message.type === 'DISCONNECT') {
    if (bg) {
      bg.disconnect();
      connected = false;
    }
    return;
  }

  tryCatch(send, message);
}
955649
function (name, data) {
            switch (name) {
                case 'pageavailable':
                    if (data.page === index + 1 || data.upto > index || data.all === true) {
                        if (status === PAGE_STATUS_CONVERTING) {
                            status = PAGE_STATUS_NOT_LOADED;
                        }
                    }
                    break;
                case 'textenabledchange':
                    if (data.enabled === true) {
                        this.enableTextSelection();
                    } else {
                        this.disableTextSelection();
                    }
                    break;
                case 'pagefocus':
                    // falls through
                case 'zoom':
                    isVisible = pageNum === data.page || (util.inArray(pageNum, data.visiblePages) > -1);
                    break;

                // no default
            }
        }
719069
public static function trigger($name, Event $data)
    {
        if (self::$dispatcher) {
            if (!is_array($name)) {
                $name=array($name);
            }
            foreach ($name as $n) {
                call_user_func_array(self::$dispatcher, self::$dispatcher_args)->dispatch($n, $data);
            }
        }
    }
7663
function callback (prefix, name, message) {
      if (!message) {
        return false;
      }
      count++;
      var msg  = errMsg(prefix, name, message);
      switch(action) {
      case 'show':
        console.log(msg);
        break;
      case 'hide':
        break;
      case 'throw':
      case 'copy':
        throw new Error(msg);
      }
      return true;
    }
1170118
function Message(data, source){
	source = source || {}
	this.data = data
	this.key = source.key
	this.sourceChannel = source.name
}
517765
function (name, data, options) {
            var _listeners = this.__handlers__[name],
                _listener,
                _result = null;
            if (_listeners) {
                for (var i = 0, length = _listeners.length; i < length; i++) {
                    _listener = _listeners[i];
                    if (_listener && _listener.handler) {
                        if(options && options.method=='apply'){
                            _result = _listener.handler.apply(_listener.context || _listener.owner, data);
                        } else {
                            _result = _listener.handler.call(_listener.context || _listener.owner, _listener.owner, data, options);
                        }
                        if (false === _result) {
                            return false;
                        }
                    }
                }
            }

            return this;
        }
63830
private void handleMessage(byte[] data) {
        Buffer buffer = new Buffer();
        buffer.write(data);
        int type = (buffer.readShort() & 0xffff) & ~(APP_MSG_RESPONSE_BIT);

        if (type == BeanMessageID.SERIAL_DATA.getRawValue()) {
            beanListener.onSerialMessageReceived(buffer.readByteArray());

        } else if (type == BeanMessageID.BT_GET_CONFIG.getRawValue()) {
            returnConfig(buffer);

        } else if (type == BeanMessageID.CC_TEMP_READ.getRawValue()) {
            returnTemperature(buffer);

        } else if (type == BeanMessageID.BL_GET_META.getRawValue()) {
            returnMetadata(buffer);

        } else if (type == BeanMessageID.BT_GET_SCRATCH.getRawValue()) {
            returnScratchData(buffer);

        } else if (type == BeanMessageID.CC_LED_READ_ALL.getRawValue()) {
            returnLed(buffer);

        } else if (type == BeanMessageID.CC_ACCEL_READ.getRawValue()) {
            returnAcceleration(buffer);

        } else if (type == BeanMessageID.CC_ACCEL_GET_RANGE.getRawValue()) {
            returnAccelerometerRange(buffer);

        // Ignore CC_LED_WRITE; it appears to be only an ack

        } else if (type == BeanMessageID.CC_GET_AR_POWER.getRawValue()) {
            returnArduinoPowerState(buffer);

        } else if (type == BeanMessageID.BL_STATUS.getRawValue()) {
            try {
                Status status = Status.fromPayload(buffer);
                handleStatus(status);

            } catch (NoEnumFoundException e) {
                Log.e(TAG, "Unable to parse status from buffer: " + buffer.toString());
                e.printStackTrace();

            }

        } else {
            String fourDigitHex = Integer.toHexString(type);
            while (fourDigitHex.length() < 4) {
                fourDigitHex = "0" + fourDigitHex;
            }
            Log.e(TAG, "Received message of unknown type 0x" + fourDigitHex);
            returnError(BeanError.UNKNOWN_MESSAGE_ID);

        }
    }
592107
function fire(name, args) {
        var handlers, i, l, callback;

        name = name.toLowerCase();
        args = args || {};
        args.type = name;

        // Setup target is there isn't one
        if (!args.target) {
          args.target = scope;
        }

        // Add event delegation methods if they are missing
        if (!args.preventDefault) {
          // Add preventDefault method
          args.preventDefault = function () {
            args.isDefaultPrevented = returnTrue;
          };

          // Add stopPropagation
          args.stopPropagation = function () {
            args.isPropagationStopped = returnTrue;
          };

          // Add stopImmediatePropagation
          args.stopImmediatePropagation = function () {
            args.isImmediatePropagationStopped = returnTrue;
          };

          // Add event delegation states
          args.isDefaultPrevented = returnFalse;
          args.isPropagationStopped = returnFalse;
          args.isImmediatePropagationStopped = returnFalse;
        }

        if (settings.beforeFire) {
          settings.beforeFire(args);
        }

        handlers = bindings[name];
        if (handlers) {
          for (i = 0, l = handlers.length; i < l; i++) {
            callback = handlers[i];

            // Unbind handlers marked with "once"
            if (callback.once) {
              off(name, callback.func);
            }

            // Stop immediate propagation if needed
            if (args.isImmediatePropagationStopped()) {
              args.stopPropagation();
              return args;
            }

            // If callback returns false then prevent default and stop all propagation
            if (callback.func.call(scope, args) === false) {
              args.preventDefault();
              return args;
            }
          }
        }

        return args;
      }