In this code example there is a way to implement the object pool pattern?
// parents
function Parent() {
this.id = 'Parent';
}
// childs
function Child1() {
Parent.call(this);
this.id = 'Child1';
this.name = 'Mario';
}
Child1.prototype = Object.create(Parent.prototype);
function Child2() {
Parent.call(this);
this.id = 'Child2';
this.name = 'Luigi';
}
Child2.prototype = Object.create(Parent.prototype);
Aucun commentaire:
Enregistrer un commentaire