Created
September 16, 2015 09:09
-
-
Save Kcko/885b7a9899f8d086b041 to your computer and use it in GitHub Desktop.
Self invoke function with public and private methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var log = { | |
target: $("#message"), | |
pridej: function(text){ | |
this.target.append(text + "<br />"); | |
}, | |
clear: function() | |
{ | |
this.target.empty() | |
} | |
}; | |
var pozdrav = (function(){ | |
var target = $("#message"); | |
var pridej = function(text){ | |
target.append(text + "<br />"); | |
}; | |
var clear = function() | |
{ | |
target.empty(); | |
}; | |
return { | |
x: pridej, | |
clear: clear | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment