-
-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean Up API, Break Backwards Compatibility #468
Comments
yes I agree with you. The API should be coherent. I think all methods returning something asynchronously should use Promises. For option parameters, at least for boolean parameters, and probably for all, we should use an options object to set the parameters, makes sense. |
I propose every function now takes a options object even if they only have 1 arg.
We should also continue to support chaining as much as possible. So code like this should work. Jimp.read('some-image.png')
.resize(100, 100)
.write('some-image-medium.png')
.resize(25, 25)
.write('some-image-small.png'); Functions that take node-style-callbacks that should return promises:
Take callback but don't need to (nothing async is done). So we can just remove the callback. They will either return a value or this depending on current implmentation:
Related Issues to be closed:
|
@edi9999 thoughts? |
Should every method just return a promise? might make the desired syntax hard |
It seems like there is a lot of work being done to ensure that the package is backward compatible. This seems a little odd to me and has led to weird API decisions. Some methods are chain-able via
this
, some return promises, and some use a node style callback. I believe we should decide on a consistent way of doing things and bump to the version to 1.0.0 since we will probably be breaking some things along the way.Another thing we should look at is how we pass arguments. Currently it can be variable and leads to many situation where we would have to make a major release(SemVer). Some other PRs and Issues discuss passing an options object instead. I think this would be the better way to go and would allow us to iterate quicker without breaking the API.
The text was updated successfully, but these errors were encountered: