publiclab / webjack

a JavaScript library that uses an audio software modem to communicate with an Arduino via a headphone jack

Home Page:https://webjack.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enable downloading log as a CSV

jywarren opened this issue · comments

It'd be great to be able to download the log as a CSV! Of course, you can just copy and paste it into a file right now. But still, a one-click button would be nice!

var csv = connection.history.received.join('\n'); // the CSV data

// old school, but doesn't seem to work for me?

window.open("data:text/csv;charset=utf-8," + escape(csv));

or generate a link: https://stackoverflow.com/questions/17564103/using-javascript-to-download-file-as-a-csv-file

<a href="data:text/csv;charset=utf-8,'+escape(csv)+'" download="webjack.csv">download</a>

We should put the timestamp (and ideally the better-formatted date + time) in the filename; new Date().toJSON().slice(0,10).replace(/-/g,'/'); gets the date, and we can add timestamp after that maybe...

Let's put the button here!

<p class="tools-bottom">
<button class="btn-baud">Change baud</button>
<button class="btn-freq">Change frequencies</button>
</p>

Hey, if its still open, can I claim it?

Hello!
Just wondering if there's been any progress on this? I'd like to submit a pull request if its still open.