sonarr-repo-only/UI/Mixins/SaveIfChangedModel.js

32 lines
780 B
JavaScript
Raw Normal View History

2013-05-31 04:06:52 +00:00
"use strict";
define(['app'], function () {
2013-05-31 04:06:52 +00:00
NzbDrone.Mixins.SaveIfChangedModel = {
// originalInitialize: this.initialize,
2013-05-31 04:06:52 +00:00
initialize: function () {
this.isSaved = true;
this.on('change', function () {
this.isSaved = false;
}, this);
this.on('sync', function () {
this.isSaved = true;
}, this);
// if (originalInitialize) {
// originalInitialize.call(this);
// }
2013-05-31 04:06:52 +00:00
},
saveIfChanged: function (options) {
if (!this.isSaved) {
this.save(undefined, options);
}
}
};
return NzbDrone.Missing.SaveIfChangedModel;
});