我只是通過timer.js HERE的代碼去,與鍍鉻的開發工具打轉轉,基本上我所說的插件,像這樣:瞭解這回在timer.js
var timer = $.timer(function(){
$('#add-html').html('Hello There !!');
});
timer.set({ time:5000 , autostart :true });
即使是演示使用相同的例子,下面的線現在執行時:
var timer = $.timer(function(){
$('#add-html').html('Hello There !!');
});
THIS LINE插件執行內部和returns this
,但什麼現在是return this
?它是整個插件的一個實例嗎?或者究竟是什麼,我知道沒有它會引發錯誤,但究竟是return this
在這裏用於什麼,它是什麼value
?
我使用return this
很多鏈接等在JavaScript中,但不知何故我無法理解在這裏return this
的上下文用法,任何人都可以解釋?
謝謝。
亞歷-Z。
return this retuns the $ .timer instance – guramidev