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

Promise methods #10

Open
sashafirsov opened this issue Oct 12, 2022 · 0 comments
Open

Promise methods #10

sashafirsov opened this issue Oct 12, 2022 · 0 comments

Comments

@sashafirsov
Copy link
Owner

CssChain elements could have members/methods to return own status as a Promise object.

There is series of patterns of multiple promise use reflected in promise helper API:

Proposed
.promiseAll(), .promiseAny(), .promiseAllSettled() to return the Promise object which would be resolved on each array element promise member or element as a Promise.

Signatures

  • .promiseAll() - array element promise member or element as a Promise.
  • .promiseAll( propName ) - element property with given name
  • .promiseAll( el=>Promise ) - callback on each element which returns a promise

If elements of $var CssChain have a promise API, following is identical:

await Promise.all( $var );
await $var.promiseAll();
await $var.promiseAll( el=>el.promise ); // when element has a promise property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant