Javascript Singleton
Ссылки на хорошие материалы по реализации данного паттерна.
var Singletone = (function () {
var instance;
return function Construct_singletone () {
if (instance) {
return instance;
}
if (this && this.constructor === Construct_singletone) {
instance = this;
} else {
return new Construct_singletone();
}
}
}());
И еще:
medium
Leave a Reply
You must be logged in to post a comment.