Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /**
* Utlity function to pause execution for a given time
* @param {number} seconds
* @returns {Promise}
*/
const sleep = seconds =>
new Promise(resolve => {
setTimeout(resolve, seconds * 1000);
});
/**
* Uiltity function to create and save a CSV file from a buffer
* @param {*} data
* @param {*} filename
*/
const saveToCSV = (data, filename = 'recordedMLSignal.csv') => {
// console.log(data)
let csvContent = 'data:text/csv;charset=utf-8,';
data.forEach((val, idx) => {
csvContent += `${idx},${val}\r\n`;
});
const encodedUri = encodeURI(csvContent);
const link = document.createElement('a');
link.setAttribute('href', encodedUri);
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
};
export {sleep, saveToCSV};
|