js函数中为何移除不了事件?

请问在 end 中为何移除不了事件?

function counter (obj){
        this.obj = obj;
        this.num = 0;
    }

    counter.prototype.start = function(){   
        var self = this;
        return  function(){
            self.obj.addEventListener( "mousemove" , self.move.apply(self,arguments) , false );
            self.obj.addEventListener( "mouseup" , self.end.apply(self,arguments) , false );
        }  
    }

    counter.prototype.move = function(){
        var self = this;
        return function(){
            document.title = self.num++;
        } 
    }

    counter.prototype.end = function(){
        var self = this;
        return function(){
            // alert(self);
            self.obj.removeEventListener( "mousemove" , self.move.apply(self,arguments) , false );
            self.obj.removeEventListener( "mouseup" , self.end.apply(self,arguments) , false );
        }   
    }

    counter.prototype.init = function(){
        var self = this;
        // alert(this);
        self.obj.addEventListener( "mousedown" , self.start.apply(self,arguments) , false );
    }


    var counterNew = new counter(document);

    counterNew.init();
阅读 3.7k
1 个回答

记住,解绑得和绑定是同一个函数

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题