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

chore : remove Q, replace with standard Promise #309

Merged
merged 1 commit into from
Jan 15, 2020

Conversation

aarongranick-okta
Copy link
Contributor

@aarongranick-okta aarongranick-okta commented Jan 14, 2020

  • support for promise.finally was added in Node v10.3. This matches the Active LTS version of Node: https://nodejs.org/en/about/releases/
    Updating our "engines" and .travis file to match.

var deferred = Q.defer();
var responseHandler;
var timeoutId;
var promise = new Promise(function(resolve, reject) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Perhaps a more descriptive name. A promise of what?

var closePoller;
var popupClosedPromise = new Promise(function(resolve, reject) {
/* eslint-disable-next-line no-case-declarations, no-inner-declarations */
function hasClosed(win) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Function name implies a boolean return w/o side effects, but it looks to actually to be all about a side-effect. Perhaps pull the reject() out and call reject() explicitly where hasClosed() is called? (At which point you can define hasClosed() externally and don't need to override eslint)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will refactor this section a bit

});
authClient.tokenManager.on('error', function() {
renewDeferred.resolve();
promise = new Promise(function(resolve) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: perhaps a more descriptive var name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a test helper setup block, it handles a very diverse range of cases. It doesn't seem like there is a more specific name we can use. It is inside a block } else if (opts.autoRenew) { so this is the autoRenew promise.

@aarongranick-okta aarongranick-okta merged commit 6ab8bc2 into v3.0 Jan 15, 2020
@aarongranick-okta aarongranick-okta deleted the ag-remove-q-OKTA-218649 branch January 15, 2020 18:53
aarongranick-okta added a commit that referenced this pull request Jan 21, 2020
Add babel, browserslist. eslint for browser compatibility (#306)

chore : remove Q, replace with standard Promise (#309)

feat: signOut uses redirect method. new method closeSession (#310)
@aarongranick-okta aarongranick-okta mentioned this pull request Jan 31, 2020
@aarongranick-okta aarongranick-okta mentioned this pull request Mar 4, 2020
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.

2 participants