Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. /* No dependency for person, so we are not passing any module */
  2. define([], function(){
  3. var name = "";
  4.  
  5. function printName(){
  6. document.getElementById("message").innerHTML = "Hi, " + name;
  7. }
  8. function getName(){
  9. return name;
  10. }
  11. function setName(newName){
  12. name = newName;
  13. }
  14.  
  15. /*Public members - Properties and behaviours that you want to make public*/
  16. return{
  17. /*no need to add the same name to property as the mapped function,
  18. but adding the same name is the recommended way */
  19. printName: printName,
  20. setName: setName,
  21. getName: getName
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement