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.pending/Promise.exec/Promise.resolved #77

Open
davesnx opened this issue Aug 14, 2023 · 0 comments
Open

Promise.pending/Promise.exec/Promise.resolved #77

davesnx opened this issue Aug 14, 2023 · 0 comments

Comments

@davesnx
Copy link
Sponsor

davesnx commented Aug 14, 2023

Current API makes creating a Promise with .pending, which is fine and wrap a callback with exec, which is fine.

I would like to propose a similar API as the new Promise, such as:

let make (fn : resolve:('a -> unit) -> reject:(exn -> unit) -> unit) : 'a Promise.t

Which might make Promise.pending a little less used/useful. Promise.make () will eventually make a pending promise, until resolve is being called internally.

Note: The same interface can be found for ReScript Js.Promise, for example.


Another change to the API that I wanted to propose is

s/Promise.resolved/Promise.resolve

In order to keep familiarity with the callback version and the JavaScript version.

@davesnx davesnx changed the title Promise.pending/Promise.exec Promise.pending/Promise.exec/Promise.resolved Aug 15, 2023
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