【Underscore.js】_.deferを読んだ
jashkenas/underscoreの_.deferを読んだ。
概要
_.defer(function, *arguments) ``` 現在のコールスタックがクリアされたあとに、functionを実行させる。 setTimeoutを0msで実行するのと似ている。 処理が重い計算や、HTMLのレンダリング等に使うと便利。
console.log('0'); (function(){ _.defer(function(){console.log('1');}); }()); console.log('2’); // 0, 2, 1
## ソースコード
.defer = .partial(.delay, , 1);
_.delayを1msで実行している。 ## 参考 [jashkenas/underscore](https://github.com/jashkenas/underscore)