I would like to call a public method from a private one but the property \"this\" refers to the window object.
Please note i am trying to apply the module pattern. Y
I understand this is a little bit different from the module pattern, but I think it still offers the same benefits of encapsulation. Public methods are declared as:
this.methodName = function(){...}
the variable $this is assigned to the current instance (this), so you can use it from within private (or public) methods to access any methods or attributes on that instance.
Fork:
http://jsfiddle.net/FNjJq/