Mithril + Google Maps

by Gabriel

HTML

<script src="//maps.google.com/maps/api/js?sensor=true"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/mithril/0.2.0/mithril.js"></script>

JavaScript

m.mount(document, {
  view: function () {
    return m( 'html',
    	m( 'head', 
      	m( 'style', '\
          #mapdiv {\
            width: 500px;\
            height: 500px;\
          }\
        ' )
      ),
      m( 'body',
        m('#mapdivcontainer',
          m('#mapdiv', {
            config: function (el, init) {
            alert(1)
              if (!init) 
                new google.maps.Map(el, {
                  center: new google.maps.LatLng(0,0),
                  zoom: 4,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
                })
            }
          })
        )
    	)
    )
  }
});