X Tutup
Skip to content

feat: split openExternal into sync and async#16176

Merged
codebytere merged 3 commits intomasterfrom
promise-open-external
Jan 15, 2019
Merged

feat: split openExternal into sync and async#16176
codebytere merged 3 commits intomasterfrom
promise-open-external

Conversation

@codebytere
Copy link
Member

@codebytere codebytere commented Dec 21, 2018

Description of Change

This API can't be promisified in the same way as previous apis, as its callback is optional.

This therefore follows Node's conventions and splits shell.openExternal(url[, options, callback]) into shell.openExternalSync(url[, options]) and shell.openExternal(url[, options]).
shell.openExternal(url[, options]) now returns a promise.

This PR also adds specs for previously-untested shell.openExternal() and also for shell.openExternalSync().

/cc @miniak @ckerr

Checklist

  • PR description included and stakeholders cc'd
  • npm test passes
  • relevant documentation is changed or added
  • PR title follows semantic commit guidelines
  • PR release notes describe the change in a way relevant to app-developers

Release Notes

Notes: promisify shell.openExternal() by splitting it into a sync and async method

@codebytere codebytere requested review from a team December 21, 2018 17:02
@codebytere codebytere force-pushed the promise-open-external branch 3 times, most recently from 4ae0b27 to feeda28 Compare December 22, 2018 15:58
@codebytere codebytere force-pushed the promise-open-external branch from 7de2451 to 25ab6bd Compare January 11, 2019 16:39
@codebytere codebytere changed the title [wip] feat: split openExternal into sync and async feat: split openExternal into sync and async Jan 11, 2019
@codebytere codebytere force-pushed the promise-open-external branch from b8fc5a5 to b7df504 Compare January 11, 2019 20:07
@codebytere codebytere force-pushed the promise-open-external branch from b7df504 to 451738f Compare January 15, 2019 01:01
void OnOpenExternalFinished(const v8::Global<v8::Context>& context,
scoped_refptr<atom::util::Promise> promise,
const std::string& error) {
v8::Isolate* isolate = promise->isolate();
Copy link
Member

@MarshallOfSound MarshallOfSound Jan 15, 2019

Choose a reason for hiding this comment

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

Should this be done in the promise helper to reduce this boilerplate being duplicated for all promises?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree moving the code to promise helper. But I would prefer doing it in a separate PR since it is a refactoring that modifies multiple files.

@codebytere codebytere merged commit 0881fd6 into master Jan 15, 2019
@release-clerk
Copy link

release-clerk bot commented Jan 15, 2019

Release Notes Persisted

promisify shell.openExternal() by splitting it into a sync and async method

@codebytere codebytere deleted the promise-open-external branch January 15, 2019 04:35
akisctx pushed a commit to akisctx/electron that referenced this pull request Jan 22, 2019
* feat: split openExternal into sync and async

* v8::Locker => mate::Locker

* fix: enter js env when resolving promise
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

X Tutup