TypeScript

by Horsetopus

HTML

<div id="app"></div>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#app {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
  text-align: center;
}

TypeScript

if ( self === undefined ) {
	
	let displayCanvas = document.createElement( "canvas" );
  displayCanvas.style.width = "100%";
  displayCanvas.style.height = "100%";
  document.body.appendChild( this._displayCanvas );

  let offscreenCanvas = this._displayCanvas.transferControlToOffscreen();
  
  let worker = new Worker( "desktopmoduleworker.js" );

  worker.postMessage( { type:"init", canvas:this._offscreenCanvas }, [ this._offscreenCanvas ] );
  
  window.onresize = () => {
  	bounds = document.body.getBoundingClientRect();
    worker.postMessage( { type:"size", width:bouds.width, height:bounds.height } );
  };
  window.onresize();
  
}
else {
	
	
}