Skip to content
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

[Refactor] Use promises in 'NetInfo' #5512

Closed
wants to merge 6 commits into from
Closed

[Refactor] Use promises in 'NetInfo' #5512

wants to merge 6 commits into from

Conversation

satya164
Copy link
Contributor

No description provided.

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @bestander, @mkonicek and @andreicoman11 to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jan 24, 2016
metered => callback(metered),
error => callback(null, error)
);
} else {

Choose a reason for hiding this comment

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

undefined This type is incompatible with Promise

@mkonicek
Copy link
Contributor

@bestander Can you review this one please as you've worked on the NetInfo API?

@bestander
Copy link
Contributor

looking into it...

@@ -233,14 +230,25 @@ const NetInfo = {
},
},

isConnectionExpensive(callback: (metered: ?boolean, error?: string) => void): void {
isConnectionExpensive(): Promise {
if (arguments.length > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure about > 1?
arguments[0] is the first argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bestander My bad, should be 0. Will fix.

@facebook-github-bot
Copy link
Contributor

@satya164 updated the pull request.

metered => callback(metered),
error => callback(null, error)
);
} else {

Choose a reason for hiding this comment

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

undefined This type is incompatible with Promise

@mkonicek
Copy link
Contributor

mkonicek commented Feb 8, 2016

I'll let @bestander review.

@mkonicek
Copy link
Contributor

mkonicek commented Feb 8, 2016

Thanks for doing this!

@satya164
Copy link
Contributor Author

satya164 commented Feb 8, 2016

@mkonicek I need to update the PR :)

@dmmiller
Copy link

dmmiller commented Feb 8, 2016

Please introduce the suggested deprecated wrapper in a separate PR so we can see that, then update this on top of that one. I'd like not to combine that in here.

@satya164
Copy link
Contributor Author

Done #5861 @dmmiller

@dmmiller
Copy link

@satya164 Thanks, left some comments over there. @bestander you should check that out as well since this was your idea initially I think.

@facebook-github-bot
Copy link
Contributor

@satya164 updated the pull request.

@facebook-github-bot
Copy link
Contributor

@satya164 updated the pull request.

@satya164
Copy link
Contributor Author

@dmmiller updated

@@ -36,13 +36,19 @@ module.exports = function(promise: Promise, callbacks: Array<Function>, type: st
res => success(res),
err => error(err)
);
case 'node': // handles func(callback)
const [ callback ] = callbacks;
case 'single-callback-value-first': // handles func(callback(err, value))

Choose a reason for hiding this comment

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

The comment indicates error first but the case indicates value first.

@facebook-github-bot
Copy link
Contributor

@satya164 updated the pull request.

@dmmiller
Copy link

@facebook-github-bot-1 shipit

@dmmiller
Copy link

@facebook-github-bot shipit

1 similar comment
@satya164
Copy link
Contributor Author

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/426911070839764/int_phab to review.

@satya164
Copy link
Contributor Author

This is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants