import {Injector,Inject} from "angular2/core";
class Canvas{ constructor(){ var canvas = document.createElement("canvas"); canvas.setAttribute("width","600px"); canvas.setAttribute("height","400px"); var host = document.querySelector("ez-app"); host.innerHTML = ""; host.appendChild(canvas); this.ctx = canvas.getContext("2d"); } }
class Face{ constructor(@Inject(Canvas) canvas){ this.canvas = canvas; } render(){ with(this.canvas.ctx){ beginPath(); strokeStyle="black"; fillStyle = "black"; arc(100,100,100,0,Math.PI2); stroke(); beginPath(); arc(70,70,20,0,Math.PI2); arc(130,70,20,0,Math.PI*2); fill(); beginPath(); arc(100,110,50,.5,Math.PI-.5); stroke(); } } }
+function bootup(){ var injector = Injector.resolveAndCreate([Canvas,Face]); var face = injector.get(Face); face.render(); }();