9 ms·
The closure section needs work. My closures never look like that. I have functions that return functions to create my closures, usually via a library via dojo.h
by apphacker 16y ago
The closure section needs work. My closures never look like that. I have functions that return functions to create my closures, usually via a library via dojo.hitch, $.hitch, or goog.bind.
- axod 16y agowindow.setTimeout(function(c){return function() { c.doSomething(); }}(this), 1000); Mine usually look like that. Using any library to do that seems like overkill to me.
- apphacker 16y agoWell a hitch or bind function delivers more than just ability to create quick closures. It lets you define the functionality you want in a named function, allowing for code re-use and more readable code. Also I'm obviously not using the library just for bind.