[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;
function doExport(objects) {
var exporter = new TimelineCSVExporter(objects);
var exporter = new TimelineCSVExporter(objects),
options = { headers: exporter.headers() };
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));
};
TimelineCSVExporter.prototype.options = function () {
return {
headers: this.columns.map(function (column) {
return column.name();
})
};
TimelineCSVExporter.prototype.headers = function () {
return this.columns.map(function (column) {
return column.name();
});
};
return TimelineCSVExporter;