Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* No dependency for person, so we are not passing any module */
- define([], function(){
- var name = "";
- function printName(){
- document.getElementById("message").innerHTML = "Hi, " + name;
- }
- function getName(){
- return name;
- }
- function setName(newName){
- name = newName;
- }
- /*Public members - Properties and behaviours that you want to make public*/
- return{
- /*no need to add the same name to property as the mapped function,
- but adding the same name is the recommended way */
- printName: printName,
- setName: setName,
- getName: getName
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement