Home > Web Front-end > JS Tutorial > body text

Year-end wrap-up: JavaScript in 2016

阿神
Release: 2017-01-17 10:36:41
Original
1089 people have browsed it

2016For every web developer, JavaScript is a very big part of their working life.

The popularity of JavaScript continues to surge. Not everyone likes the language, but you rarely hear the derisive opinions of a decade ago. Personally, I've always loved JavaScript, even in those early, frustrating years. Anyone approaching it from the C++, Java, or PHP direction will be confused at first: JavaScript looks familiar, but isn't. Get over your assumptions and you'll love its simple elegance, practicality and flexibility. (For example: Date processing is still a nightmare!)

JavaScript celebrated its 21st birthday in May, so let’s take a look back at its first year of maturity...

ECMAScript Development

viaES6/2015 is the most important update to the language since its birth. It took seven years to complete the specification, but browsers and runtimes are finally starting to support arrow functions, let, and const, which makes for a lot more fun. The ES6 compatibility table is turning a glowing green.

If you need to support older browsers, it may be a little early to fully switch to ES6. For older browsers, project released over a year ago. You can use an ES6 to ES5 compiler (such as Babel), but development is very complex and requires the introduction of additional build steps.

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

Progressive Web Apps

via My favorite JavaScript-based technology of 2016 goes to Progressive Web Apps. PWAs were announced at Google's 2015 Chrome Developer Summit, but stable technology and tools finally arrived in Chrome 52 in July. PWA allows offline-first functionality and replaces the flaky AppCache approach. Web applications can finally compete with native applications and offer the following advantages:

1. Home screen icons

2. Quick launch and custom splash screen

3. Quick execution

4. Offline functionality, no internet connection required

5. URLs, links and bookmarks

6. Full screen or themed interface

7. Sand Box execution

8. Local or cloud-based storage

9. Less device space and processing resources

10. Better security (HTTPS is a prerequisite )

11. Easily discoverable from any search engine

12. Please try before installing

13. Easier deployment: it is just a web application

14. No AppStore crap: your app can contain any nude drawing and you will absolutely be dying that no one can take away your 30% of the profits!

The bottom line is: any website or app can be converted to a PWA in a matter of hours. Steps:

1. Enable HTTPS on the server.

2. Create an application manifest - a JSON file in the application root directory that defines the name, colors, icons and display options.

3. Create a Service Worker - JavaScript file in the root directory is used to intercept network calls and can return cached or real-time data as needed.

There are few early examples, but PWAs provide a good opportunity to "mobilize" your web application. While there's no guarantee Apple will implement this technology, it doesn't matter, your app will still work in Safari, it just won't benefit from offline execution. I have a feeling that once the web experience on Android is significantly improved, Apple will encourage support for PWA.

Framework Fixed

via It’s hard to make a fair judgment, but React seems to be getting the most attention this year. You may not agree; because it depends on what you are using, where you have been and what you have said!

Vue.js has become popular, and version 2.0 was released in September.

AngularJS may have lost some of the momentum it gained in 2015, but that may change with the release of Angular 2 in September. The new version is a complete rewrite; it is not backwards compatible with v1.0.

While new frameworks and libraries are exciting, jQuery from ten years ago is still going strong. Version 3.0 was released on June 9th, with v3.1 following on July 7th. The library now runs in strict mode, supports Promises, and has various fixes implemented. (See the upgrade guide for a complete list of changes.)

jQuery is used on 96.4% of sites that use JavaScript. In comparison, Angular is the most used modern framework - at 0.5%. jQuery 1.x is the most popular version, accounting for 93.5% usage. Version 2.x accounts for 6.0% and version 3.x accounts for 0.5%.

I have always criticized developers for using jQuery directly. It is overused when there is a more suitable alternative or when only a small piece of JavaScript can achieve the requirement. However, it offers a shallower learning curve and is more flexible than most frameworks. It will take many years for other frameworks or libraries to replace it.

API abuse

For example, battery status API. When I was writing JavaScript in 2013, it seemed useful; how could you better minimize network requests and processing when your app detects that the user's phone is about to shut down?

Unfortunately, Mozilla estimates that about 6% of websites use this API, but most of them are domains used by advertisers to detect battery status and track which websites users browse. It is also possible that some service providers know that a user's phone is about to shut down and are desperate, and use this to increase the price of certain services.

Although this is not a JavaScript or API issue, for privacy reasons, Mozilla Taking the unprecedented step of removing the battery status API from Firefox 53. This is unlikely to appear in iOS devices, other APIs with similar reasons include sensors and bluetooth. This is a bit of a shame: these APIs all have real benefits, and I hope privacy concerns can be addressed in future releases.

Node new version

Node.JS will bring us two release schedules every year, version 6.0 in April and version 7.0 in October.

The platform is currently on the rise, although W3Techs reports Node.js server usage is only 0.2%, compared to 82.3% for PHP. These numbers can be a bit misleading, as Node.js is not necessarily recognized even if it is installed.

Because PHP has been around for a long time and is still the most reliable choice for the server. However, Node.js is writing its own history and is widely used by developers of all language persuasions.

Yarn

I really like npm and think it is one of the main reasons why Node.js tools are so popular. I've never had too many problems with npm, but I'm not working on a project as big as Facebook.

Facebook engineers released Yarn in October. It is a new Node.js package manager designed to be faster and more stable than npm. It relies on the npm registry and therefore remains fully compatible with npm.

Yarn vs npm by Tim Severien: Everything you need to know. I agree with his conclusion:

Although Yarn is not a clone, it improves several of npm's shortcomings. Wouldn’t it be cool if npm learned from Yarn and asked Facebook, Google, and other Yarn contributors to improve npm?

Tired and Fatigued

An article in 2016 called I-can't-take-this-any-more was selected into Jose Aguinaga's 2016 Topics for Learning JavaScript Feel.

This may be a humorous way to indicate the current state of JavaScript, but the point is that it is becoming increasingly difficult to keep up with the latest trends, frameworks and recommendations. When faced with a large number of technical solution evaluations, developers will fight with each other.

My advice: Don’t try to keep up. Because this simply can't be done. Any system you focus on today will be replaced by something better tomorrow. Choose a good solution for your project and stick with it unless it makes the job terrible.

One thing that is certain is JavaScript itself. Learn the language first and continue to expand your knowledge. Your experience will help you understand how each framework works so you can make an informed choice, even if that choice may be to abandon all frameworks altogether.

I wish everyone all the best in work and life in 2017.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!