Closed XionWCFM closed 4 months ago
Latest commit: e91db6231acaa3566435b5fdffb4f3b456368a76
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
overlay-kit | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 15, 2024 5:50am |
Description
This change implements the openAsync method for overly-kit's promise support discussed in #47.
Related Issue: Fixes #47
Changes
Motivation and Context
Although overlay-kit emphasizes support for promises in its documentation, there was a problem with boilerplate due to the lack of explicit support for promises.
To address this issue, we add openAsync explicit support for promises.
How Has This Been Tested?
I tested through test code that the parameters passed to openAsync's close method return resolved values, and that the close method properly closes the overlay on the screen.
Types of changes
Checklist
Further Comments
In order to adhere to the DRY principle and minimize modifications to existing code, openAsync was implemented in the form of wrapping open. Is this implementation acceptable?
The close method of openAsync is implemented to require parameters. The reason I implemented it this way is because if an optional parameter is allowed, type assertion through as is required internally, which makes it type-safe, or there is the inconvenience of the user having to infer undefind even though the confirmation value is actually passed. I also chose a type-safe implementation because we believed that the core of Promise use cases lies in using checked values. I'm curious about your opinion on this part.
Would it be a good idea to add docs for openAsync in that PR? If I had to add it, I would like to know which document it would be best to add it to. I am prepared when it comes to writing documents.