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

Promise support #7

Open
brysgo opened this issue May 18, 2018 · 8 comments
Open

Promise support #7

brysgo opened this issue May 18, 2018 · 8 comments
Milestone

Comments

@brysgo
Copy link
Contributor

brysgo commented May 18, 2018

I converted the newly announced 2.0.0-rc1 branch to support promises in the getAuthLevel function. This is useful for fetching models for authorization. Still needs tests and a promise polyfill (for pre es6 support). I'm just trying to figure out if people are interested.

@chrismatix
Copy link
Contributor

That would be really useful. Let's await @makinde's merge and then we can review that PR. How would you like to add the polyfill? We could add Typescript.

@brysgo
Copy link
Contributor Author

brysgo commented May 18, 2018

Awesome! Would be cool to add typescript, it would clean up the code a bunch.

@dvideby0
Copy link
Contributor

@xChrisPx I forget if I got you setup to push to npm as well. If not just let me know and Im happy to help so you can get v2 out.

@makinde
Copy link
Contributor

makinde commented May 18, 2018

Nice, that would be cool, and I might need that as well :)

There are a couple decisions to make here:

  • I bumped the min node version to 8.2.1 in my latest, so as it stands, someone needs to be running a version of node that support async/await and other pretty recent features. That said, the actual code doesn't use stuff that's too advanced. It just made it a lot easier to write the tests. I don't have any experience with babel, but that could be a way to keep writing in ES2017 and then have the code transpiled into more basic JS (and effectively have polyfills inserted for us. I'm not sure how folks feel about having a build step, but I really like async/await over having to write .then().catch().

[edit] removed my comment about typescript.

@makinde
Copy link
Contributor

makinde commented May 18, 2018

Let me amend what I said, just peeked at the docs. It looks like typescript is mainly at the function interfaces. So it doesn't look too hard to follow the lead of others here. I'm slightly less skeptical :P

@brysgo
Copy link
Contributor Author

brysgo commented May 18, 2018

I have used typescript and babel, I don't get too crazy with the types so I don't have a strong opinion either way.

@chrismatix
Copy link
Contributor

Sorry for being late to the discussion: We use Typescript exclusively on the server side and it is a great advantage. We don't have to go to crazy with the types either.

I will create a PR right away. The good thing is that we don't need to add types, if we don't want to, but we also get all the nice polyfills.

@chrismatix chrismatix added this to the v2.0.0 milestone May 19, 2018
@brysgo
Copy link
Contributor Author

brysgo commented May 20, 2018

If anyone is interested in taking a look, PR #23 adds promise support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants