So I've got something like this...
(function(window) {
function MyPro(el) {
this._init(el);
}
MyPro.prototype._init = function(el) {
var self = this;
...
}
MyPro.prototype.toggle = function(display) {
var self = this;
...
}
MyPro.prototype.clearSelected = function() {
var self = this;
...
}
window.MyPro = MyPro;
})(window);
Where many of these methods have callbacks and nesting, and all require the line var self = this;
. I can stick with it, if I must, but is there no way that I can do this globally (within the prototype) just once?
I tried...
(function(window) {
var self = this;
function MyPro(el) {
self._init(el);
}
...
And then leaving out each individual definition, but it didn't work out. It's been a while since I've gotten heavy into the nuances of JS, and some things like this keep escaping me.