2012-03-13 83 views
2

我有錯誤:$ clear沒有定義..這段代碼有什麼錯?我使用Mootools 1.4.5:

var test = new Class({ 
    initialize: function(){}, 


    init: function(){ 
     var timer; 
     $$('#list tr').addEvents({ 
      'click': function(){ 
       $clear(timer); 
       timer = (function(){ 
        console.log('clicked'); 
       }).delay(200, this); 
       }, 
       'dblclick': function(){ 
        $clear(timer); 
        console.log('dblclicked'); 
       } 

      }); 
    } 
}); 

謝謝!

回答

7

$clear已被棄用,因爲它只是複製了內置的clearTimeout函數。我猜想現在已經被刪除了。

編輯:廢棄的函數僅包括在Mootools的1.45

+0

謝謝!謝謝!謝謝! – Ste 2012-03-20 11:33:13

+0

不客氣:) – 2012-03-20 11:58:05

2

的「兼容性」版本的解決方案將是如下:

取代的兩個實例: $清晰(定時器);

With: clearTimeout(timer);

在1.3版本之後,有許多功能已棄用。這裏是一個很好的鏈接,幫助您任何的mootools 1.2代碼升級到1.3/4

http://www.mooforum.net/help-f26/upgrade-update-guide-t3643.html