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

Allow to return promise of token from login function #401

Closed
jcubic opened this issue May 21, 2018 · 1 comment
Closed

Allow to return promise of token from login function #401

jcubic opened this issue May 21, 2018 · 1 comment

Comments

@jcubic
Copy link
Owner

jcubic commented May 21, 2018

Expected behavior

  • Feature that will allow to return promise from login or use async..await + return token.

Actual behavior

Right now if you use async you need to call the callback.

Steps to reproduce

function delay(value, ms) {
    return new Promise((resolve) => {
        setTimeout(() => resolve(value), ms);
    });
}
$('body').terminal($.noop, {
    login: async function(user, pass, callback) {
        var x = await delay({token: '4abxd9'}, 1000);
        return x.token;
    }
});
@jcubic
Copy link
Owner Author

jcubic commented May 21, 2018

Terminal should also pause when value from login is a 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

No branches or pull requests

1 participant