-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from callbacks to promises (#40)
* Migrate callback logic to promise - Add timeout option to throw an error if no response is returned - Downgrade the Dropbox dependency to 7.0.0 - Add Upgrading.md for v2.0.0 * Add upgrading.md
- Loading branch information
Showing
6 changed files
with
81 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Upgrading the OAuth Popup | ||
|
||
This document shows you how to upgrade to the latest version of the popup, accomodating any breaking changes introduced by major version updates. If you find any issues with either this guide on upgrading or the changes introduced in the new version, please see file an issue. | ||
|
||
# Upgrading from v1.X.X to v2.X.X | ||
|
||
## Updating from callbacks to promises | ||
|
||
We have updated the library to use the newer promises over callbacks. Previously this would have looked like this: | ||
|
||
``` | ||
var popup = new DropboxPopup(); | ||
popup.authUser((auth) => { | ||
// Do logic with auth | ||
}); | ||
``` | ||
|
||
This now becomes: | ||
|
||
``` | ||
var popup = new DropboxPopup(); | ||
popup.authUser().then((auth) => { | ||
// Do logic with auth | ||
}).catch((error) => { | ||
// Handle Error | ||
}); | ||
``` | ||
|
||
## Timeout Functionality | ||
|
||
We have also added timeout functionality. When attempting to authenticate, we will timeout and throw an error if the request is not fulfilled in the time specified. The default is 5 minutes but can be configured to any time in milliseconds. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters