Getting error CreateListFromArrayLike called on non-object when trying to use .apply()

前端 未结 3 550
北海茫月
北海茫月 2020-12-28 12:45

I\'ve created a simple little route parsing function so that I can keep my code clean and easily maintainable, this is the little function that gets ran when the app starts

3条回答
  •  天命终不由人
    2020-12-28 13:00

    I have the same problem, so i verified that node_modules/socket.io/lib/socket.js was received

    Socket.prototype.onevent = function(packet){
      var args = packet.data || [];
      debug('emitting event %j', args);
    
      if (null != packet.id) {
        debug('attaching ack callback to event');
        args.push(this.ack(packet.id));
      }
    
      emit.apply(this, args);
    };

    so i changed to:

    Socket.prototype.onevent = function(packet){
      var args = packet.data || [];
      debug('emitting event %j', args);
        
      if (null != packet.id) {
      debug('attaching ack callback to event');
      args.push(this.ack(packet.id));
      }
        
      emit.apply(this, [args]);
     };  

    it's solve to me

提交回复
热议问题