Santa Tracker Developer Diary #8: Tracker

Chrome for Developers · Beginner ·📰 AI News & Updates ·8y ago

Key Takeaways

Builds a Santa Tracker using SVG, Custom Elements, and Chrome for Developers tools

Full Transcript

hey everyone it's Sam here on the last episode of the Santa Tracker developer diary for this year I want to talk about the tracker itself now this is what you see if you go to Santa tracker on the 24th or 25th as Santa is flying around the world delivering presents to all the good boys and girls now the tracker is made up of a couple of things it's made up of the map itself it's made up of the way we get data from the server to show where Santa is and we also want to reuse the map throughout the site which is pretty cool let's have a look so this is the tracker itself we can see Santa fly around the world here we can see where he currently is he's in San Francisco and you can see that he's not at any presents because this is actually a trial run we can see a few other things too like the weather and we also play some games down here so unlike the village which is very interactive we keep this simple and show the games in a card layout there's also a few secret games that aren't normally visible but are just made available for the tracker itself like this trivia game here we also have a few videos to watch down the bottom and a social feed so we fetch Santa's route in one of two ways based on whether you're on the android client or on the web obviously this is a series about web but on android we use the firebase remote config api which is actually really nice as it allows us to send down a JSON blob to clients and actually update that fairly rapidly that's really important because if Santa changes his route on the fly we can get a new version almost immediately we do something very similar on the web we've got an API server which is internal which kind of emulates the same thing than our case we pull that every minute or so and so this sync method here on the Santa service object actually does that work for us so this is called every minute or so and it requests our info object and so that returns things like the current status any upgrades that are acquired by the client let's say your site's out-of-date and then it also includes things like the route so we then use the route method here which builds on that data we already fetched and we fetch the data this route URL here as you can see we're actually storing at a local storage as well their routes quite large when it's not gzipped it's about 500k when it's gzipped it's much smaller but we still want to saw that in local storage rather than fetching it every time a user navigates back to the site and that JSON we store in firebase storage Santa uploads it there when a new is submitted so how do we then use that route so inside our new tracker scene as opposed to our old tracker as we've got some great naming right here we actually call the Santa sync method when sync happens and so that method if we can find it does a couple of things it basically takes the data that we have and does a few more updates there's a bit of a chain here as we can see so as a result of Santa's sync we update Santa's state which basically means placing Center on the map so that's really nice right you can say this is actually a really simple call here we say this Maps ant all that long equal started opposition which is the Santa's current position but actually what's really cool is while you always obviously see the map here with everything around all the you know little cards and stuff like that we can actually use this as a reasonable component which i think is really interesting let's look at this tracker demo page all this does is take a reusable tracker map element and places on the page here so of course that's not very interesting we don't know where Santa is we haven't hooked it up to the API but I think this is really cool because as someone who works in the web I can take this component and reuse it in a bunch of places on my side and in Santa tracker we do that we use the map obviously in the tracker itself but we also use a cut-down version of the map in our cast experience because chromecast is quite an underpowered device we don't want to do too much on that so we only want to show the map in Santa we don't want to show other information about the social feed or other videos or things like that so the way we can use this is so i've created a thing called map which is the object team and I can say map dot Santa lat/long equals let's pick a location I also seem to set map Santa heading equals let's say 120 so great this turns out to be the middle of the ocean but we can see that Santa is flying in a certain direction I can even turn them around this is quite cute and we love the idea that we can reuse this custom element anywhere in our site and this is something we get through polymer so while this is obviously a very simple example this tracker map here is very powerful and it allows us to wrap up a bunch of the behavior and a bunch of the stuff we want to do with Santa tracker every year like show the markers of where Sanders being and show his route line so every year Santa visits about 500 different cities around the world give or take however he is a bit magical and turns out he wants to deliver the presents to everybody no matter where you are what we actually do is take your geoip now GRP is pretty coarse it's only about city level detail but we use that to make sure center visit to your house no matter what so if you're up late in the 24th this year make sure you check out Santa tracker because said it might just be above your place thanks for watching this year have a happy holidays and I hope Santa's good to you see you next year you can subscribe to the google chrome developer channel down here we'll check out some other great videos along here [Music]

Original Description

On the last episode of the Santa Tracker Developer Diary for 2017, learn about Santa's big journey, how we build a reusable tracker, and how he might just come to your place 🎅🔜🏡. https://github.com/google/santa-tracker-web https://santatracker.google.com Watch the rest of the series here: https://goo.gl/UD214n Subscribe to the Chrome Developers channel: http://goo.gl/LLLNvf
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Chrome for Developers · Chrome for Developers · 0 of 60

← Previous Next →
1 Polymer Performance Patterns (The Polymer Summit 2015)
Polymer Performance Patterns (The Polymer Summit 2015)
Chrome for Developers
2 Polymer Power Tools (The Polymer Summit 2015)
Polymer Power Tools (The Polymer Summit 2015)
Chrome for Developers
3 Chrome Dev Summit 2014 – Chrome Case Studies
Chrome Dev Summit 2014 – Chrome Case Studies
Chrome for Developers
4 Web Directions Code 2015 round up
Web Directions Code 2015 round up
Chrome for Developers
5 Maintainable Code - HTTP203
Maintainable Code - HTTP203
Chrome for Developers
6 iron-ajax… wat?! -- Polycasts #26
iron-ajax… wat?! -- Polycasts #26
Chrome for Developers
7 The Guardian - Supercharged
The Guardian - Supercharged
Chrome for Developers
8 ES2015 (next version of JavaScript), Totally Tooling Tips (S2 Ep1)
ES2015 (next version of JavaScript), Totally Tooling Tips (S2 Ep1)
Chrome for Developers
9 #AskPolymer: Rob answers all the questions ever -- Polycasts #27
#AskPolymer: Rob answers all the questions ever -- Polycasts #27
Chrome for Developers
10 The Future of JavaScript - HTTP203
The Future of JavaScript - HTTP203
Chrome for Developers
11 Data Binding 101 -- Polycasts #28
Data Binding 101 -- Polycasts #28
Chrome for Developers
12 The Guardian part 2 - Supercharged
The Guardian part 2 - Supercharged
Chrome for Developers
13 The Future of Web Audio: with Chris Wilson and Chris Lowis
The Future of Web Audio: with Chris Wilson and Chris Lowis
Chrome for Developers
14 Chrome 46: New motion-path animations, client hints and service worker improvements
Chrome 46: New motion-path animations, client hints and service worker improvements
Chrome for Developers
15 Sublime Snippets, Totally Tooling Tips (S2 Ep2)
Sublime Snippets, Totally Tooling Tips (S2 Ep2)
Chrome for Developers
16 #AskPolymer: How do you make the show? -- Polycasts #29
#AskPolymer: How do you make the show? -- Polycasts #29
Chrome for Developers
17 Critical Path CSS, Totally Tooling Tips (S2 Mini Tip #1)
Critical Path CSS, Totally Tooling Tips (S2 Mini Tip #1)
Chrome for Developers
18 Binding to Objects -- Polycasts #30
Binding to Objects -- Polycasts #30
Chrome for Developers
19 Player FM - Supercharged
Player FM - Supercharged
Chrome for Developers
20 Where’s the Designer? #AskPolymer -- Polycasts #31
Where’s the Designer? #AskPolymer -- Polycasts #31
Chrome for Developers
21 Jake Beats Wikipedia - HTTP203
Jake Beats Wikipedia - HTTP203
Chrome for Developers
22 Supercharged Observers! -- Polycasts #32
Supercharged Observers! -- Polycasts #32
Chrome for Developers
23 Jai's Web blog - Supercharged
Jai's Web blog - Supercharged
Chrome for Developers
24 Windows Command-line Tooling, Totally Tooling Tips (S2, Ep4)
Windows Command-line Tooling, Totally Tooling Tips (S2, Ep4)
Chrome for Developers
25 What about internationalization? #AskPolymer -- Polycasts #33
What about internationalization? #AskPolymer -- Polycasts #33
Chrome for Developers
26 Developing for Billions (Chrome Dev Summit 2015)
Developing for Billions (Chrome Dev Summit 2015)
Chrome for Developers
27 Google+ Performance Improvement Comparison
Google+ Performance Improvement Comparison
Chrome for Developers
28 Deploying HTTPS: The Green Lock and Beyond (Chrome Dev Summit 2015)
Deploying HTTPS: The Green Lock and Beyond (Chrome Dev Summit 2015)
Chrome for Developers
29 Progressive Web Apps (Chrome Dev Summit 2015)
Progressive Web Apps (Chrome Dev Summit 2015)
Chrome for Developers
30 Instant Loading with Service Workers (Chrome Dev Summit 2015)
Instant Loading with Service Workers (Chrome Dev Summit 2015)
Chrome for Developers
31 Increase Engagement with Web Push Notifications (Chrome Dev Summit 2015)
Increase Engagement with Web Push Notifications (Chrome Dev Summit 2015)
Chrome for Developers
32 Engaging with the Real World: Web Bluetooth and Physical Web (Chrome Dev Summit 2015)
Engaging with the Real World: Web Bluetooth and Physical Web (Chrome Dev Summit 2015)
Chrome for Developers
33 Asking for Permission: respectful, opinionated UI (Chrome Dev Summit 2015)
Asking for Permission: respectful, opinionated UI (Chrome Dev Summit 2015)
Chrome for Developers
34 Polymer - State of the Union (Chrome Dev Summit 2015)
Polymer - State of the Union (Chrome Dev Summit 2015)
Chrome for Developers
35 Building Progressive Web Apps with Polymer (Chrome Dev Summit 2015)
Building Progressive Web Apps with Polymer (Chrome Dev Summit 2015)
Chrome for Developers
36 Introduction to RAIL (Chrome Dev Summit 2015)
Introduction to RAIL (Chrome Dev Summit 2015)
Chrome for Developers
37 DevTools in 2015: Authoring to the max (Chrome Dev Summit 2015)
DevTools in 2015: Authoring to the max (Chrome Dev Summit 2015)
Chrome for Developers
38 RAIL in the real world (Chrome Dev Summit 2015)
RAIL in the real world (Chrome Dev Summit 2015)
Chrome for Developers
39 #ChromeDevSummit talks are up - W00T! -- Polycast #34
#ChromeDevSummit talks are up - W00T! -- Polycast #34
Chrome for Developers
40 V8 Performance from the Driver's Seat (Chrome Dev Summit 2015)
V8 Performance from the Driver's Seat (Chrome Dev Summit 2015)
Chrome for Developers
41 Quantify and improve real-world RAIL (Chrome Dev Summit 2015)
Quantify and improve real-world RAIL (Chrome Dev Summit 2015)
Chrome for Developers
42 Owning your performance: RAIL (Chrome Dev Summit 2015)
Owning your performance: RAIL (Chrome Dev Summit 2015)
Chrome for Developers
43 HTTP/2 101 (Chrome Dev Summit 2015)
HTTP/2 101 (Chrome Dev Summit 2015)
Chrome for Developers
44 Leadership Panel (Chrome Dev Summit 2015)
Leadership Panel (Chrome Dev Summit 2015)
Chrome for Developers
45 Build Processes, Totally Tooling Tips (S2, Ep 5)
Build Processes, Totally Tooling Tips (S2, Ep 5)
Chrome for Developers
46 Accessibility (Chrome Dev Summit 2015)
Accessibility (Chrome Dev Summit 2015)
Chrome for Developers
47 Binding to Arrays -- Polycasts #35
Binding to Arrays -- Polycasts #35
Chrome for Developers
48 HTTP2 - HTTP203
HTTP2 - HTTP203
Chrome for Developers
49 Chrome 47: Splash Screens, requestIdleCallback and better desktop notifications (New in Chrome)
Chrome 47: Splash Screens, requestIdleCallback and better desktop notifications (New in Chrome)
Chrome for Developers
50 Call For Submissions - Supercharged
Call For Submissions - Supercharged
Chrome for Developers
51 Cross Device Testing, Totally Tooling Tips (S2 Ep6)
Cross Device Testing, Totally Tooling Tips (S2 Ep6)
Chrome for Developers
52 Testing AJAX with Web Component Tester -- Polycasts #37
Testing AJAX with Web Component Tester -- Polycasts #37
Chrome for Developers
53 Slack: Extended Xmas Special - Supercharged
Slack: Extended Xmas Special - Supercharged
Chrome for Developers
54 Browser testing with Travis & Sauce Labs -- Polycasts #38
Browser testing with Travis & Sauce Labs -- Polycasts #38
Chrome for Developers
55 Optimize for production with Vulcanize -- Polycasts #39
Optimize for production with Vulcanize -- Polycasts #39
Chrome for Developers
56 Highlights from Chrome Dev Summit 2015
Highlights from Chrome Dev Summit 2015
Chrome for Developers
57 Chrome 48: Custom buttons in notifications, DevTools Security panel, and Presentation mode
Chrome 48: Custom buttons in notifications, DevTools Security panel, and Presentation mode
Chrome for Developers
58 Crisper: Protecting your Polymer app with CSP -- Polycasts #40
Crisper: Protecting your Polymer app with CSP -- Polycasts #40
Chrome for Developers
59 How do I use Sass with Polymer? #AskPolymer -- Polycasts #41
How do I use Sass with Polymer? #AskPolymer -- Polycasts #41
Chrome for Developers
60 Colors – DevTools Tonight #0 (Pilot)
Colors – DevTools Tonight #0 (Pilot)
Chrome for Developers

Related Reads

📰
EU tech chief and Tim Cook hold ‘constructive’ talks as Siri AI stays blocked in Europe
EU tech chief and Tim Cook discuss Siri AI blockade in Europe, describing talks as 'constructive'
The Next Web AI
📰
Claude Sonnet 5 Didn’t Just Get Smarter. It Changed the Economics of AI.
Learn how Claude Sonnet 5's advancements changed the economics of AI, making 'good enough AI' viable for production, and understand the implications for AI development and deployment
Medium · AI
📰
Claude Sonnet 5 Didn’t Just Get Smarter. It Changed the Economics of AI.
Claude Sonnet 5's improved AI capabilities have transformed the economics of AI, making it more viable for production
Medium · Machine Learning
📰
MGX’s $49 Billion AI Fund Signals Abu Dhabi’s Long-Term Technology Ambitions
Abu Dhabi invests $49 billion in AI fund through MGX, signaling long-term tech ambitions
Medium · AI
Up next
Man dies after horror Gold Coast house fire; high-speed Sydney motorway pursuit | 9 News Australia
9 News Australia
Watch →