dataservice.js
var dataservice = (function(){
var
msg = 'Welcome to Code Camp',
getMessage = function(){
return msg;
};
return{
getMessage: getMessage
};
})();
alerter.js
var alerter = (function (dataservice){
var
name = 'John',
showMessage = function(){
var msg = dataservice.getMessage();
alert(msg + ', ' + name);
};
return{
showMessage: showMessage
};
})(dataservice);
main.js
(function (alerter){
alerter.showMessage();
})(alerter);
No comments:
Post a Comment