snappymail/dev/Stores/User/Template.js
RainLoop Team 8da988fef2 Synchronize localizations from Transifex
Update package.json dependencies
Fix eslint errors
webpack 2 -> webpack 3
2017-06-24 22:26:27 +03:00

38 lines
845 B
JavaScript

import ko from 'ko';
import _ from '_';
// import Remote from 'Remote/User/Ajax';
class TemplateUserStore
{
constructor() {
this.templates = ko.observableArray([]);
this.templates.loading = ko.observable(false).extend({throttle: 100});
this.templatesNames = ko.observableArray([]).extend({throttle: 1000});
this.templatesNames.skipFirst = true;
this.subscribers();
}
subscribers() {
this.templates.subscribe((list) => {
this.templatesNames(_.compact(_.map(list, (item) => (item ? item.name : null))));
});
// this.templatesNames.subscribe((aList) => {
// if (this.templatesNames.skipFirst)
// {
// this.templatesNames.skipFirst = false;
// }
// else if (aList && 1 < aList.length)
// {
// Remote.templatesSortOrder(null, aList);
// }
// });
}
}
export default new TemplateUserStore();