Re:Smartcrop.js (2014)
by inglor on Wednesday January 20, 2016 @06:35AM
(#10937379)
This is what cargo culting looks like: https://github.com/jwagner/smartcrop.js/blob/master/smartcro... it takes a callback "just for good measure" but is a completely synchronous library.
[ Parent
| on HN ]
Re:Smartcrop.js (2014)
by curryhoward on Wednesday January 20, 2016 @06:46AM
(#10937420)
To give the author the benefit of the doubt, maybe he plans to eventually make the computation happen asynchronously (e.g., in a web worker), or at least maybe he wants to leave that possibility open. Then the API wouldn't need to change.
NO it is not. Curryhoward is absolutely right: The reason behind this decision was to keep a consistent API when smartcrop might get broken into multiple calls to avoid blocking the mainloop for too long.
With that said, this should have been documented more clearly.
Re:Smartcrop.js (2014)
by infinite8s on Wednesday January 20, 2016 @10:22AM
(#10938626)
It's always easier to layer synchronous semantics on top of asynchronous than the other way around. Maybe the author intends on advanced usage using webworkers or a webservice.