snappymail/dev/Stores/User/Template.js

29 lines
756 B
JavaScript
Raw Normal View History

import ko from 'ko';
2016-06-30 08:02:45 +08:00
// import Remote from 'Remote/User/Fetch';
2016-06-30 08:02:45 +08:00
export const TemplateUserStore = new class {
constructor() {
this.templates = ko.observableArray();
this.templates.loading = ko.observable(false).extend({ debounce: 100 });
2016-06-30 08:02:45 +08:00
this.templatesNames = ko.observableArray().extend({ debounce: 1000 });
this.templatesNames.skipFirst = true;
2016-06-30 08:02:45 +08:00
this.templates.subscribe((list) => {
this.templatesNames(list.map(item => (item ? item.name : null)).filter(v => v));
});
// this.templatesNames.subscribe((aList) => {
// if (this.templatesNames.skipFirst)
// {
// this.templatesNames.skipFirst = false;
// }
// else if (aList && aList.length)
// {
// Remote.templatesSortOrder(null, aList);
// }
// });
}
};