-
Notifications
You must be signed in to change notification settings - Fork 17
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
'use nodent-promises' not working ("No 'use nodent' directive, assumed -es7 mode") #3
Comments
I'm assuming you're trying to get this to work from the command line. I took the code above above and pasted it into
..which generated the output:
To suppress the warning, simple put as the first line
The main issue you have is that your declaration of "tellYouLater" should NOT be declared Both "use nodent-es7" and "use nodent-promise" work in the browser. For your use case (interfacing with standard JS functions that use callbacks) you'll probably want to "use nodent-promise" and include a Promise library (the online demo uses bluebird, but has been tested with native Chrome Promises, rsvp & when). There are a few hoops to jump through using nodent in the browser, which I'm afraid I haven't documented very well. The best description can be found in issue #2. That having been said, the code has been tested on IE, FF and Chrome reasonably extensively in the, and once you've got the hang of it (specifically remembering to define Function.prototype.$asyncbind) it works well. Pre-compiling on the command line requires an extra build step - if you're using node.js to serve, you can get it to trans-compile on-the-fly which makes testing a but easier. I hope that answers your question. |
Thanks, it works now -- but only when using I was using Thanks for the tips on running in the browser...it seems to me that the main advantage of your library over Babel is better performance (both server-side and especially client-side). It sounds like a promises library e.g. bluebird and the small |
You're quite right.
|
...in the browser obviously you need to using |
Thank you for the helpful info. That answers my questions, but for the sake of the next person it would be good to update the readme file so it says "use nodent-promise" instead of "use nodent-promises". Thanks :) |
Oops! Thanks for pointing that out. It's now corrected. |
I tried using the
"use nodent-promises";
directive as described in the documentation, but nodent.js doesn't seem to recognize it:My goal is to get this test code working:
In the docs it says, "If you want your code to remain compatible with standard ES7 implementations when the arrive, use the second form above", referring to the
new Promise
syntax. I tried that with the "use nodent-es7" directive, but that output an empty object rather than "Hi there". Ideally I would like to get this working with "use nodent-es7" since I want my code to work in the browser as well -- is there no way to do that and remain future-compatible with ES7 (i.e. without a hard dependency on nodent)?P.S. Thanks for this great library; I have been hoping for quite a while that someone would write such a library and only just now discovered it!
The text was updated successfully, but these errors were encountered: