25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ES2015<br />

The <strong>js</strong> Mix method applies the Babel plugin to Webpack, ensuring that any<br />

ES2015 code is transpiled down to browser-friendly ES5 before it's added to the<br />

bundle file.<br />

We wrote the <strong>Vue</strong>bnb frontend app prototype using only ES5 syntax, as we ran it<br />

directly in the browser without any build step. But now we can take advantage of<br />

ES2015 syntax, which includes a lot of h<strong>and</strong>y features.<br />

For example, we can use a shorth<strong>and</strong> for assigning a function to an object<br />

property.<br />

resources/assets/<strong>js</strong>/app.<strong>js</strong>: escapeKeyListener: function(evt) { ... }<br />

Can be changed to this: escapeKeyListener(evt) { ... }<br />

There are several instances of this in app.<strong>js</strong> that we can change. There aren't any<br />

other opportunities for using ES2015 syntax in our code yet, though in the<br />

coming chapters we'll see more.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!