Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created September 16, 2015 09:09
Show Gist options
  • Save Kcko/885b7a9899f8d086b041 to your computer and use it in GitHub Desktop.
Save Kcko/885b7a9899f8d086b041 to your computer and use it in GitHub Desktop.
Self invoke function with public and private methods
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