(self.webpackChunkttgtcanvas=self.webpackChunkttgtcanvas||[]).push([[568],{568:(e,t,a)=>{e.exports=a(367),e.exports.version=a(306).version},367:(e,t,a)=>{var n=a(337),o=a(431),s=n.DOMWidgetModel.extend({defaults:o.extend(n.DOMWidgetModel.prototype.defaults(),{_model_name:"CanvasModel",_view_name:"CanvasView",_model_module:"ttgtcanvas",_view_module:"ttgtcanvas",_model_module_version:"0.1.2",_view_module_version:"0.1.2",current_call:"{}",method_return:"{}"})}),r=n.DOMWidgetView.extend({render:function(){this.canvas=document.createElement("canvas"),console.log(this.canvas),this.el.append(this.canvas),console.log("render",this),this.model.on("change:current_call",this.method_changed,this)},method_changed:function(){console.log("current_call");let e=JSON.parse(this.model.get("current_call"));console.log("current_call",this);let t=this[e.method_name].apply(this,e.params);console.log("current_call",e);let a=this;return Promise.resolve(t).then((function(t){console.log("reached in promise");let n=JSON.stringify({value:t,cb:+new Date,params:e.params,method:e.method_name});return console.log("setting return",n),a.model.set("method_return",n),a.model.save_changes(),n}))},update_div:function(e,t){return console.log("update_div",e),this.el.textContent=e,new Promise((function(e,a){setTimeout(e,t)}))},draw_canvas:function(){let e=this.canvas.getContext("2d");e.globalCompositeOperation="destination-over",e.clearRect(0,0,300,300),e.fillStyle="rgba(0, 0, 0, 0.4)",e.strokeStyle="rgba(0, 153, 255, 0.4)",e.save(),e.translate(150,150);var t=new Date;e.rotate(2*Math.PI/60*t.getSeconds()+2*Math.PI/6e4*t.getMilliseconds()),e.translate(105,0),e.fillRect(0,-12,40,24),e.drawImage(earth,-12,-12),e.save(),e.rotate(2*Math.PI/6*t.getSeconds()+2*Math.PI/6e3*t.getMilliseconds()),e.translate(0,28.5),e.drawImage(moon,-3.5,-3.5),e.restore(),e.restore(),e.beginPath(),e.arc(150,150,105,0,2*Math.PI,!1),e.stroke(),e.drawImage(sun,0,0,300,300),window.requestAnimationFrame(this.draw_canvas.bind(this))}});e.exports={CanvasModel:s,CanvasView:r}},306:e=>{"use strict";e.exports={version:"0.1.2"}}}]);