8000 feat: promisify dialog.showOpenDialog() by codebytere · Pull Request #16973 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: promisify dialog.showOpenDialog() #16973

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

Merged
merged 3 commits into from
Mar 5, 2019
Merged

Conversation

codebytere
Copy link
Member
@codebytere codebytere commented Feb 14, 2019

Description of Change

Promisifies dialog.showOpenDialog().

cc @ckerr @MarshallOfSound @deepak1556

Checklist

Release Notes

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

@codebytere codebytere requested review from a team February 14, 2019 20:07
@codebytere codebytere changed the title [wip] feat: promisify dialog.showOpenDialog() feat: promisify dialog.showOpenDialog() Feb 14, 2019
@codebytere codebytere force-pushed the promisify-showopendialog branch from 4bcec77 to bb9cbc7 Compare February 14, 2019 23:36
@codebytere codebytere changed the title feat: promisify dialog.showOpenDialog() [wip] feat: promisify dialog.showOpenDialog() Feb 15, 2019
@codebytere codebytere added the semver/major incompatible API changes label Feb 15, 2019
@codebytere codebytere force-pushed the promisify-showopendialog branch 2 times, most recently from f0169e8 to 0cca779 Compare February 15, 2019 16:47
@codebytere codebytere changed the title [wip] feat: promisify dialog.showOpenDialog() feat: promisify dialog.showOpenDialog() Feb 15, 2019
@codebytere codebytere changed the title feat: promisify dialog.showOpenDialog() [wip] feat: promisify dialog.showOpenDialog() Feb 16, 2019
@codebytere codebytere force-pushed the promisify-showopendialog branch from 4fd58e0 to c056a03 Compare February 16, 2019 16:45
@codebytere codebytere changed the title [wip] feat: promisify dialog.showOpenDialog() feat: promisify dialog.showOpenDialog() Feb 16, 2019
@codebytere codebytere force-pushed the promisify-showopendialog branch from c056a03 to 10cc766 Compare February 19, 2019 13:44
@codebytere
Copy link
Member Author
codebytere commented Feb 19, 2019

Needs rebase on #17050 once it's merged.

@codebytere codebytere force-pushed the promisify-showopendialog branch 2 times, most recently from d3f91d1 to 2bca51f Compare February 25, 2019 08:27
@codebytere codebytere force-pushed the promisify-showopendialog branch from f517b0e to 271d772 Compare February 26, 2019 12:27
@codebytere codebytere force-pushed the promisify-showopendialog branch 3 times, most recently from ac6dc6e to 6f4ba16 Compare February 27, 2019 09:01
@codebytere codebytere force-pushed the promisify-showopendialog branch from 6f4ba16 to 9d9098a Compare March 1, 2019 08:37
Copy link
Contributor
@miniak miniak left a comment

Choose a reason for hiding this comment

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

can you please include this change as well a757e25?
it refactors the ELECTRON_INSPECTOR_SELECT_FILE IPC handler to use the promisified version of dialog.showOpenDialog()

@codebytere
Copy link
Member Author
codebytere commented Mar 4, 2019

@miniak i'd rather that be a separate PR once this gets merged so they can be reviewed separately and not create scope creep

@codebytere codebytere force-pushed the promisify-showopendialog branch from 0efad7d to 674cb11 Compare March 4, 2019 06:31
@miniak
Copy link
Contributor
miniak commented Mar 4, 2019

@codebytere ok

Copy link
Contributor
@miniak miniak left a comment

Choose a reason for hiding this comment

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

this fix needs to be included to avoid breaking devtools

diff --git a/lib/browser/chrome-devtools.js b/lib/browser/chrome-devtools.js
index f2db33344..b3aa84f0f 100644
--- a/lib/browser/chrome-devtools.js
+++ b/lib/browser/chrome-devtools.js
@@ -86,9 +86,9 @@ ipcMainUtils.handle('ELECTRON_INSPECTOR_SELECT_FILE', function (event) {
   return new Promise((resolve, reject) => {
     assertChromeDevTools(event.sender, 'window.UI.createFileSelectorElement()')
 
-    dialog.showOpenDialog({}, function (files) {
-      if (files) {
-        const path = files[0]
+    dialog.showOpenDialog({}, function (result) {
+      if (!result.canceled) {
+        const path = result.filePaths[0]
         fs.readFile(path, (error, data) => {
           if (error) {
             reject(error)

@codebytere codebytere merged commit e059851 into master Mar 5, 2019
@release-clerk
Copy link
release-clerk bot commented Mar 5, 2019

Release Notes Persisted

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

@codebytere codebytere deleted the promisify-showopendialog branch March 5, 2019 13:54
kiku-jw pushed a commit to kiku-jw/electron that referenced this pull request May 16, 2019
* feat: promisify dialog.showOpenDialog()

* address feedback from review

* address feedback from review
briandk added a commit to briandk/transcriptase that referenced this pull request Oct 11, 2019
jtojnar added a commit to jtojnar/markdown-image-insertion that referenced this pull request Apr 14, 2021
Electron 6 used by Atom 1.54 splits the methods:
- electron/electron#17298
- electron/electron#16973

Fixes: #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/major incompatible API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0