Skip to content

feat: promisify dialog.showMessageBox() - #17298

Merged
codebytere merged 2 commits into
masterfrom
promisify-showmessagebox
Mar 12, 2019
Merged

codebytere merged 2 commits into
masterfrom
promisify-showmessagebox

Conversation

@codebytere

@codebytere codebytere commented Mar 8, 2019 •

Copy link
Copy Markdown
Member

Description of Change

Promisify dialog.showMessageBox() by splitting it into a sync and async method.

Checklist

Release Notes

Notes: Split dialog.showMessageBox() into a synchronous version and a version that returns a Promise.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Mar 8, 2019
@codebytere
codebytere force-pushed the promisify-showmessagebox branch from fbbd012 to 14b4f1c Compare March 8, 2019 19:37
Comment thread docs/api/dialog.md
@codebytere codebytere mentioned this pull request Mar 8, 2019
4 tasks done
@codebytere
codebytere force-pushed the promisify-showmessagebox branch 2 times, most recently from 8784230 to 72eaf8b Compare March 8, 2019 23:01
@codebytere
codebytere marked this pull request as ready for review March 8, 2019 23:02
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Mar 9, 2019
@codebytere
codebytere force-pushed the promisify-showmessagebox branch 2 times, most recently from a1c60a1 to 125bf27 Compare March 11, 2019 20:12
@codebytere
codebytere force-pushed the promisify-showmessagebox branch from 125bf27 to fe834ac Compare March 11, 2019 21:08
Comment thread atom/browser/api/atom_api_dialog.cc Outdated
cancel_id, options, title, message, detail, icon);
}

void ResolvePromiseObject(const atom::util::CopyablePromise& promise,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CopyablePromise should only be used when there is no other choice, such as passing it to some Chromium APIs.

For ShowMessageBox, we should change its callback type to base::OnceCallback, and then use base::BindOnce and move-only Promise for callbacks.

@codebytere
codebytere force-pushed the promisify-showmessagebox branch from 94dac9d to ec9a591 Compare March 12, 2019 05:30
@codebytere
codebytere requested a review from zcbenz March 12, 2019 05:52
Comment thread atom/browser/ui/message_box_win.cc Outdated
@codebytere
codebytere force-pushed the promisify-showmessagebox branch from ec9a591 to 44e7fa9 Compare March 12, 2019 15:08
@codebytere codebytere changed the title feat: promisify dialog.showMessageBox() feat: promisify dialog.showMessageBox() Mar 12, 2019
@codebytere
codebytere merged commit 8991c00 into master Mar 12, 2019
@release-clerk

release-clerk Bot commented Mar 12, 2019

Copy link
Copy Markdown

Release Notes Persisted

Split dialog.showMessageBox() into a synchronous version and a version that returns a Promise.

@audionerd

audionerd commented Jul 30, 2019 •

Copy link
Copy Markdown

This should probably be listed as a "breaking change" in the release notes. Or maybe described with more context, e.g.:

dialog.showMessageBox has been renamed to dialog.showMessageBoxSync. dialog.showMessageBox now returns a Promise.

Any existing call to dialog.showMessageBox will now return a Promise instead of a value. So users will need to change to dialog.showMessageBoxSync to return to the prior behavior, or modify their code to accept a Promise instead.

@mhenr18

mhenr18 commented Oct 22, 2019

Copy link
Copy Markdown

I fully support @audionerd 's comment about updating the docs - I only caught this because the typings for electron updated to reflect the breaking API change and our typescript codebase failed to compile.

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

Successfully merging this pull request may close these issues.

5 participants