mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Moved resize+app settings to AbstractSettingController
This commit is contained in:
26
src/js/controller/settings/AbstractSettingController.js
Normal file
26
src/js/controller/settings/AbstractSettingController.js
Normal file
@@ -0,0 +1,26 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.controller.settings');
|
||||
ns.AbstractSettingController = function () {};
|
||||
|
||||
ns.AbstractSettingController.prototype.addEventListener = function (el, type, callback) {
|
||||
pskl.utils.Event.addEventListener(el, type, callback, this);
|
||||
};
|
||||
|
||||
|
||||
ns.AbstractSettingController.prototype.destroy = function () {
|
||||
pskl.utils.Event.removeAllEventListeners(this);
|
||||
this.nullifyDomReferences_();
|
||||
};
|
||||
|
||||
ns.AbstractSettingController.prototype.nullifyDomReferences_ = function () {
|
||||
for (var key in this) {
|
||||
if (this.hasOwnProperty(key)) {
|
||||
var isHTMLElement = this[key] && this[key].nodeName;
|
||||
if (isHTMLElement) {
|
||||
this[key] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user