An Introduction to ES6 Modules for Ionic Developers


By Josh Morony

Ionic applications rely heavily on the concept of modules, which is functionality that was introduced in the ES6 specification for Javascript. Technically, Ionic applications use TypeScript syntax not just plain ES6, but TypeScript is just an extension of ES6 so the concept is the same.

To put everything into context, the Javascript that developers have been working with over the past few years has been based on the ES5 specification. This specification did not include support for creating modular code with classes, which is pretty important for a programming language, so people found ways to work around this. The ES6 specification does support classes, so now we can create modules that we can define in one file, and then import that functionality somewhere else in our application.

Even though we are able to make use of these ES6 features right now, ES6 is not widely supported by browsers. The code we write is actually transpiled into the equivalent ES5 code so that it will run properly in browsers, but we don’t need to worry about that because we can just use ES6 features and the Ionic build process will handle this transpiling for us.

Read the full article...

Share on Google Plus

About www. codeandyou.com

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment