Slide 7
Slide 7 text
AMD & Require.js
define(‘hello’, [‘jquery’, ‘something’], function($, something) {
function Hello(name) {
this.name = name;
}
Hello.prototype.say = function(el) {
var text = ‘Hello, ‘ + something(name) + ‘!’;
$(el).text(text);
};
return Hello;
});
!
require([‘hello’], function(Hello) {
new Hello(‘Taro’).say(document.body);
});