message: feat: enhance event processor
diff: @@ -22,6 +22,8 @@ var arrySlice = Array.prototype.slice;
  * param: {string} eventType
  * param: {string|Object} query
  * return: {boolean}
  + * @param {Function} [eventProcessor.afterTrigger] Call after all handlers called.
  + * param: {string} eventType
  */
  var Eventful = function (eventProcessor) {
  this._$handlers = {};
  @@ -147,7 +149,7 @@ Eventful.prototype = {
  if (_h[event]) {
  var newList = [];
  for (var i = 0, l = _h[event].length; i < l; i++) {
  - if (_h[event][i].h != handler) {
  + if (_h[event][i].h !== handler) {
  newList.push(_h[event][i]);
  }
  }
  @@ -171,16 +173,17 @@ Eventful.prototype = {
  * @param {string} type The event name.
  */
  trigger: function (type) {
  - if (this._$handlers[type]) {
  + var _h = this._$handlers[type];
  + var eventProcessor = this._$eventProcessor;
  +
  + if (_h) {
  var args = arguments;
  var argLen = args.length;
  - var eventProcessor = this._$eventProcessor;
  if (argLen > 3) {
  args = arrySlice.call(args, 1);
  }
  - var _h = this._$handlers[type];
  var len = _h.length;
  for (var i = 0; i < len;) {
  var hItem = _h[i];
  @@ -220,6 +223,9 @@ Eventful.prototype = {
  }
  }
  + eventProcessor && eventProcessor.afterTrigger
  + && eventProcessor.afterTrigger(type);
  +
  return this;
  },
  @@ -229,17 +235,18 @@ Eventful.prototype = {
  * @param {string} type The event name.
  */
  triggerWithContext: function (type) {
  - if (this._$handlers[type]) {
  + var _h = this._$handlers[type];
  + var eventProcessor = this._$eventProcessor;
  +
  + if (_h) {
  var args = arguments;
  var argLen = args.length;
  - var eventProcessor = this._$eventProcessor;
  if (argLen > 4) {
  args = arrySlice.call(args, 1, args.length - 1);
  }
  var ctx = args[args.length - 1];
  - var _h = this._$handlers[type];
  var len = _h.length;
  for (var i = 0; i < len;) {
  var hItem = _h[i];
  @@ -279,6 +286,9 @@ Eventful.prototype = {
  }
  }
  + eventProcessor && eventProcessor.afterTrigger
  + && eventProcessor.afterTrigger(type);
  +
  return this;
  }
  };
  