Hi,
in one of the feedback on my book, I got a question why it would make sense to use a singleton:
var instance;
Layout.getInstance = function() {
if (!instance) {
instance = new Layout();
}
return instance;
}
module.exports = Layout;
instead of:
var instance;
Layout.getInstance = function() {
if (instance) {
instance.remove();
instance = new Layout();
}
return instance;
}
As I actually saw the singleton idea in an example on Thorax, I wonder if someone here has a pointer, to what is better.
In Chaplin, there are controllers for setting up layouts, if I understood correctly.
Any ideas, suggestions?
Thanks!
Patrick