Skip to content
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

[Request] promise support #1806

Closed
happyDemon opened this issue Jun 26, 2016 · 5 comments
Closed

[Request] promise support #1806

happyDemon opened this issue Jun 26, 2016 · 5 comments
Labels
stale Used to mark stale issues

Comments

@happyDemon
Copy link

happyDemon commented Jun 26, 2016

Subject of the issue

I'm writing an image dimension validation rule (for which I have to wait for the image to load in order to be able to check its width & height). Normally I'd make a promise and return that while the image is being loaded. Once the image is loaded it would be easy to resolve or reject the promise based on the defined dimension restrictions.

I thought the remote rule would be the same (since out of the box it returns a promise). but it only seems to return 'pending'.

is there an easy way for me actually implement this rule? or is a promise-based return value on the schedule?

I have implemented this in parsleyJS which was able to take a promise as a return, so I'm kind of confused why it's not possible here.

Your environment

n/a

Steps to reproduce

n/a

Expected behaviour

n/a

Actual behaviour

n/a

@staabm
Copy link
Member

staabm commented Jun 26, 2016

This library pre-dates promises in JS, so thats the reason why those are not yet supported.

I am open to discuss how a promise integration could look like though.

@happyDemon
Copy link
Author

hopefully it shouldn't be too hard, switching out the "pending" handler with a promise handler is basically what needs to be done.
This promise handler would need to support jquery 1.x & 2.x flavoured promises and the standard JS promises (also featured in jquery 3).
After that a little rewrite of the remote rule and we're done.

I can get cracking on a pull request.

@staabm
Copy link
Member

staabm commented Jun 26, 2016

I would be ok to only support ES6 promises.

The change needs to be backwards compatible though.

@santiagodoldan
Copy link

@happyDemon were you able to implement something? I'd like to help if possible

@stale
Copy link

stale bot commented Jun 5, 2018

This issue/proposal has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up.
Thank you for contributing :)

@stale stale bot added the stale Used to mark stale issues label Jun 5, 2018
@stale stale bot closed this as completed Jun 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Used to mark stale issues
Projects
None yet
Development

No branches or pull requests

3 participants