Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Polymer and Firebase

Henry Lim
December 19, 2015

Intro to Polymer and Firebase

Event: Barcamp Cyberjaya 2015

Topic: Polymer, Firebase

Henry Lim

December 19, 2015
Tweet

More Decks by Henry Lim

Other Decks in Technology

Transcript

  1. <paper-toolbar> <div>MY APP</div> </paper-toolbar> <paper-toolbar> A basic container for controls

    like tabs or buttons MY APP @polymer <link rel=“import” href=“paper-toolbar.html”>
  2. A responsive container that combines a left- or right-side drawer

    panel and a main content area. <paper-drawer-panel> <paper-drawer-panel> <div drawer> Drawer panel... </div> <div main> Main panel... </div> </paper-drawer-panel>
  3. <paper-drawer-panel> <div drawer> Drawer panel... </div> <div main> Main panel...

    </div> </paper-drawer-panel> A responsive container that combines a left- or right-side drawer panel and a main content area. <paper-drawer-panel>
  4. <paper-drawer-panel> <div drawer> Drawer panel... </div> <div main> Main panel...

    </div> </paper-drawer-panel> A responsive container that combines a left- or right-side drawer panel and a main content area. <paper-drawer-panel>
  5. } </style> <div id="map"></div> <script src=“http://maps.googleapis.com/maps/api/js?callback=mapReady"> </script> <script> var marker

    = null; function getCurrentLocation(callback) { navigator.geolocation.watchPosition(callback); } function addMarker(opts, info) { var marker = new google.maps.Marker(opts); var infoWindow = new google.maps.InfoWindow({content: info}); google.maps.event.addListener(marker, 'click', function() { infoWindow.open(opts.map, marker); }); return marker; } function mapReady() { var container = document.querySelector('#map'); var map = new google.maps.Map(container, { zoom: 14, disableDefaultUI: true }); getCurrentLocation(function(pos) { var current = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude); map.setCenter(current); // Re-position marker or create new one. if (marker) { marker.setPosition(map.getCenter()); } else { marker = addMarker({ position: current, map: map, title: 'Your location' }, '<b>Your location</b>'); } So much code for one map marker! @polymer