1 define([ 'tables', 'util/report' ], function (tables, report) {
3 var el = document.getElementById(id);
4 var customEl = document.getElementById(id + '-custom');
6 return el.value || (customEl && customEl.value);
9 function getAgentMetadata() {
10 if (typeof window !== 'undefined' && window) {
12 userAgent: window.navigator.userAgent,
13 language: window.navigator.language,
14 browser: val('ua-browser'),
15 name: val('ua-device-name'),
25 function csvReport(results, agentMetadata) {
26 agentMetadata = agentMetadata || getAgentMetadata();
30 reports.push(report.csvByObject(agentMetadata));
33 Object.keys(tables.performance).forEach(function (testName) {
34 var layout = report.makeTableLayout(tables.performance[testName]);
35 reports.push(report.csvByLayout(results[testName], layout, [ testName ]));
38 return reports.join('\n\n') + '\n';
43 getAgentMetadata: getAgentMetadata