jquery4u.com - Archives (décembre 2016)

1 jQuery Fan Blog for your Daily News, Plugins, Tuts/Tips & Code Snippets.

Le: 19 12 2016 à 22:00 Auteur: Craig Buckler

JavaScript in review, 2016

2016 has been a monumental, bizarre, and somewhat jubilant/terrifying year depending on your outlook. To concentrate on JavaScript alone may seem inconsequential compared to other events, but it's a huge part of every web developer's working life.

JavaScript popularity continues to explode. Not everyone loves the language, but you rarely hear the derisive comments of a decade ago. Personally, I've always loved JavaScript --- even in the early, frustrating years. Those approaching it from a C++, Java or PHP direction can be confused at first: JavaScript looks familiar, but isn't. Overcome your presumptions and you'll appreciate its simple elegance, practicality and flexibility. (That said, date handling is still a nightmare!)

JavaScript celebrated its 21st birthday in May, so let's look back at its first year of adult maturity …

ECMAScript Evolution

ES6/2015 was the most significant update to the language since its birth. The specification took seven years to complete, but browsers and runtimes are finally starting to support arrow functions, let, const, proxies and more delights. The ES6 compatibility table is turning a glorious shade of green.

Perhaps it's a little early to fully switch to ES6 if you're supporting older browsers. By older, I mean anything released more than a year ago. You can use an ES6-to-ES5 compiler such as Babel, but development is complicated enough without introducing an additional build step.

ES7/2016 is more evolution than revolution. One exciting new feature is async, which allows asynchronous code to be written in a synchronous manner without the syntactical complexities of callbacks or Promises (which continue to confuse me).

Progressive Web Apps

My favorite JavaScript-based technology of 2016 is awarded to Progressive Web Apps. PWAs were announced in Google's 2015 Chrome Dev Summit, but stable technologies and tools finally arrived in Chrome 52 in July. PWAs permit offline-first functionality and supersede flaky AppCache methods. Web apps can finally compete with native apps and offer the benefits of:

  • a home screen icon
  • fast launching and custom splash screens
  • snappy execution
  • offline functionality without an internet connection
  • URLs, linking and bookmarking
  • full-screen or themed interfaces
  • sandboxed execution
  • local and/or cloud-based storage with synchronization
  • fewer device space and processing resources
  • better security (HTTPS is a prerequisite)
  • easy discovery from any search engine
  • try before you install
  • simpler deployment: it's just a web app
  • no AppStore nonsense: your app can contain whatever nudity and swearing you desire without someone demanding 30% of your profits!

Best of all: any website or application can be transformed into a PWA within a few hours. The steps:

  1. Enable HTTPS on your server.
  2. Create an application manifest --- a JSON file in your application root which defines the name, colors, icons and display options.
  3. Create a Service Worker --- a JavaScript file in your root which intercepts network calls and can return cached or live data as necessary.

It's early days, and examples are rare, but PWAs offer an amazing opportunity to “mobilify” your web applications. Admittedly, there's no guarantee Apple will implement the technology, but it shouldn't matter: your app will still work in Safari, it just won't benefit from offline execution. I have a feeling Apple will be encouraged to support PWAs once the web experiences becomes noticeably superior on Android.

For more information, see Dev.Opera's Progressive Web Apps: The definitive collection of resources and Google's PWA Guides.

Continue reading %JavaScript: 2016 in Review%