webP7/index.js

21 lines
534 B
JavaScript

'use strict'
document.getElementById('connect').addEventListener('click', async function () {
p7.device = {};
var time = performance.now();
await p7.init()
.catch((err) => {
console.error(err);
throw err;
}).then((deviceInfo) => console.log(deviceInfo));
console.log('Done. (in ' + Math.round(performance.now() - time) + 'ms)');
});
let input = document.getElementById('input');
input.addEventListener('change', async () => {
await p7.commands.flash.sendFile(input.files[0], '');
console.log('Done.');
});