microbit-web-components
Version:
Web Components library for micro:bit
1 lines • 2.48 kB
JavaScript
var __awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function s(e){try{o(n.next(e))}catch(e){a(e)}}function u(e){try{o(n["throw"](e))}catch(e){a(e)}}function o(e){e.done?i(e.value):new r(function(t){t(e.value)}).then(s,u)}o((n=n.apply(e,t||[])).next())})};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(e){return function(t){return o([e,t])}}function o(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(a=s[0]&2?i["return"]:s[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;if(i=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(s[0]===6&&r.label<a[1]){r.label=a[1];a=s;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(s);break}if(a[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];i=0}finally{n=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-79150c1d.system.js","./p-86f8a157.system.js"],function(e){"use strict";var t,r,n,i;return{setters:[function(e){t=e.r;r=e.h;n=e.g},function(e){i=e.m}],execute:function(){var a=function(){function e(e){t(this,e);this.services=null;this.disabled=true;this.data="";i.addListener(this)}e.prototype.servicesUpdated=function(){return __awaiter(this,void 0,void 0,function(){var e;var t=this;return __generator(this,function(r){switch(r.label){case 0:this.disabled=!this.services||!this.services.uartService;e=this.services.uartService;if(!e){this.data="";return[2]}return[4,e.addEventListener("receiveText",function(e){return t.data+=e.detail})];case 1:r.sent();return[2]}})})};e.prototype.render=function(){var e={whiteSpace:"pre"};return r("span",{style:e},this.data)};Object.defineProperty(e.prototype,"el",{get:function(){return n(this)},enumerable:true,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{services:["servicesUpdated"]}},enumerable:true,configurable:true});return e}();e("microbit_receive",a)}}});