5 ms·
This is what cargo culting looks like: https://github.com/jwagner/smartcrop.js/blob/master/smartcrop.js#L116-L117 https://github.com/jwagner/smartcrop.js/blob/m
by inglor 11y ago
This is what cargo culting looks like: https://github.com/jwagner/smartcrop.js/blob/master/smartcrop.js#L116-L117 https://github.com/jwagner/smartcrop.js/blob/master/smartcro... it takes a callback "just for good measure" but is a completely synchronous library.
- x1024 11y agoIf the callback were optional, the API call would've been completely fine IMHO.
- curryhoward 11y agoTo 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.
- jwagner 11y agoNO 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.
- infinite8s 11y agoIt'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.