Consider the following classes
var CrudPage = P(function(crud)
{
var self = crud;
crud.container = '#none';
crud.init = function() {
self = this;
$(document)
.on('click', function()
{
alert(self.container);
});
}
}
var UserPage = P(CrudPage, function(user, crud)
{
movimentacao.container = '#user';
});
var ProductPage = P(CrudPage, function(product, crud)
{
movimentacao.container = '#product';
});
All fine. Loved the implementation.
Lets go to the problem, thats occours on instantiation
# we create the instances
var user = UserPage();
var product = ProductPage();
# and trigger our test click
$(document).trigger('click');
The private self, used to reference the Class out of the this scope, got overwritten by each instance. So the events don't know UserPage anymore.
Consider the following classes
All fine. Loved the implementation.
Lets go to the problem, thats occours on instantiation
The private
self, used to reference the Class out of thethisscope, got overwritten by each instance. So the events don't knowUserPageanymore.