I\'m reading the source from mongoose
Collection.prototype.onOpen = function () {
var self = this;
this.buffer = false;
self.doQueue();
};
<
You're right, in this instance they could have simply used this
.
The use of me
or self
is a bit of a hack to ensure the correct context of this
is used, as within JavaScript the scope of this
is variant. If for example you have an event trigger a function within your class, this
would be different, and wouldn't be your object that houses the function, but instead the object that called the function. To resolve this people often use me
or self
to ensure they're referring to the correct object... this
, as in the actual object.