MeetMagento Italy 2017
[Full talk on youtube: https://www.youtube.com/watch?v=95_HBtTyV9A]
It’s time of exciting news in the frontend and Javascript world, Magento2 embraces the changes by acquiring modern instruments. One of these is Require.js, the most popular module loader for Javascript.
25. define([
"jquery"
], function ($) {
'use strict';
function awesomeMenu() {
return "this is a private function";
}
return function () {
var message = awesomeMenu();
alert(message);
}
});
36. Benefits
1. Asynchronous module loading, deferred execution.
2. More clean and maintainable code.
3. Code & data sharing between different modules.
4. Global variables avoidance.