[Timeline] Simplify interface

...such that responsibility for knowing exportService interface
is more localized.
This commit is contained in:
Victor Woeltjen 2016-03-08 10:04:09 -08:00
parent 75d6803c9f
commit 43db52fd70
2 changed files with 7 additions and 8 deletions

View File

@ -45,9 +45,10 @@ define([
var exportService = this.exportService; var exportService = this.exportService;
function doExport(objects) { function doExport(objects) {
var exporter = new TimelineCSVExporter(objects); var exporter = new TimelineCSVExporter(objects),
options = { headers: exporter.headers() };
return exporter.rows().then(function (rows) { return exporter.rows().then(function (rows) {
return exportService.exportCSV(rows, exporter.options()); return exportService.exportCSV(rows, options);
}); });
} }

View File

@ -93,12 +93,10 @@ define([
return Promise.all(this.domainObjects.map(toRow)); return Promise.all(this.domainObjects.map(toRow));
}; };
TimelineCSVExporter.prototype.options = function () { TimelineCSVExporter.prototype.headers = function () {
return { return this.columns.map(function (column) {
headers: this.columns.map(function (column) {
return column.name(); return column.name();
}) });
};
}; };
return TimelineCSVExporter; return TimelineCSVExporter;