microbit-web-components
Version:
Web Components library for micro:bit
1 lines • 599 B
JavaScript
import{r as e,h as s,g as t}from"./p-416d80af.js";import{m as i}from"./p-ede9ed58.js";class r{constructor(s){e(this,s),this.services=null,this.dfuLabel="Initiate DFU",this.disabled=!0,i.addListener(this)}async servicesUpdated(){this.disabled=!this.services||!this.services.dfuControlService}async calibrate(){this.services.dfuControlService&&await this.services.dfuControlService.requestDfu()}render(){return s("button",{disabled:this.disabled,onClick:()=>this.calibrate()},this.dfuLabel)}get el(){return t(this)}static get watchers(){return{services:["servicesUpdated"]}}}export{r as microbit_dfu};