-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Try writing some code using ES6 #158
Comments
This might also allow us to close #114. |
Do you have any specific transpiler in mind to recommend? Should we also emit an es5 folder in the dist directory (or somewhere else)? Should the es5 files be included in the bower package? |
There is also babeljs which was previously 6to5. |
After some comparison of babel and traceur I spotted some differences. I think babel is using object property definition. Is this es3 polyfillable? |
@thgreasi for older browser you must use the es5-shim and the babel polyfill. There is a section at the end of babel caveats page
|
@stephanebachelier 👍 it look like that loose mode produces cleaner code without the need of Object.defineProperty. |
Just created a branch to test babel. As side notes:
|
So far that looks good, I like being able to use the I'm moving right now (Canada to the UK!) so I can't code/test much stuff but happy to review things later, whenever you can get to them 👍 |
Hi I'm a Babel contributor. @thgreasi if you want to leave out the If you need any other help let me know or ask in our support chat: https://gitter.im/babel/babel |
Thanks @thejameskyle 👍 |
We're looking to improve that in the future, right now if you need a global in the UMD you can use esperanto like the boilerplate does. |
Thanks, I will take a look at it asap. |
@thejameskyle We do import some files programmatically and so I was System.import('aDriver') Into something like Esperanto/UMD+Globals. Does this actually make any sense? On Sun, Apr 19, 2015, 09:48 James Kyle notifications@github.com wrote:
|
System.import is apparently the future since it's being officially standardized. I'd give a -1 to moving away from that. |
I thought it got removed in the April's es6 draft!?!?!? |
Huh, good point. I hadn't heard about that yet. |
I don't know how you'd dynamically load something in a UMD. You could certainly do it if you were using a module loader like system.js. |
UMD supports AMD which is all about dynamic loading no? |
Yeah but the point of the UMD is to work in all environments (AMD, Common.js, Globals). |
The current UMD formatter does a great job in creating modules that can be imported using any/many different module systems. LocalForage tries to dynamically load the drivers and the common Serializer, by guessing the available module system available. It currently supports global and commonjs/browserify imports as well as async loading with AMD/requirejs. That's so that the user can benefit the most of his module loader of choice, no matter what he is using (RequireJS/Browserify/GlobalNamespace). I was discussing about creating a Transformer (if there isn't one already) that would allow to programmatically import UMD modules no matter what the module loading scheme is used at runtime. I would expect that such a Transformer would change expressions like: System.import('aDriver').then(...); To something like: new Promise(function(resolve, reject)){
if (System && typeof System.import === "function") {
System.import('aDriver', resolve);
} else if (typeof define === "function" && define.amd) {
require(['aDriver'], resolve);
} else if (typeof exports !== "undefined") {
resolve(require('aDriver'));
} else {
resolve(globalObject['aDriver']);
}
}).then(...); I guess I should probably move this discussion to the babel repo... PS: I chose |
It might be nice to experiment with some ES6 goodness in localForage. And with #157, we can nicely transform it to ES5 for distribution.
The text was updated successfully, but these errors were encountered: