News for hackers. Stuff that matters.
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.
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.
Re:Smartcrop.js (2014) by jwagner on Wednesday January 20, 2016 @07:27AM (#10937588)
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.
Re:Smartcrop.js (2014) by x1024 on Wednesday January 20, 2016 @06:44AM (#10937410)
If the callback were optional, the API call would've been completely fine IMHO.