Skip to content

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

@davesnx

Description

@davesnx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions