Speaker: Aurelio De Rosa
Language: English
People don't give a f**k of JavaScript. You shouldn't either. We are here to do stuff, whether you call them websites, web applications, web services or hybrid apps. People want to perform tasks, not listen to you talking about your favorite programming language. So, use the one you're more comfortable with and just release the next big thing. But, if your favorite language is JavaScript, let's write better code. What does better mean? Better for developers, better for devices, better for users.
In this talk, I'll describe some of the latest JavaScript APIs that can help you to develop great code. In a bunch of minutes, you'll see how to use:
- The High Resolution Time and the User Timing APIs to help yourself testing your code performances;
- The Page Visibility and the Battery Status APIs to take care of devices' resources;
- The Vibration and the getUserMedia APIs to create better User Experiences.
4Developers: http://4developers.org.pl/pl/
10. 3 QUESTIONS FOR YOU
1. Do you think they understand programming languages?
2. Do you think they know what JavaScript is?
3. Do you think they care about JavaScript?
25. “A Bing study found that a 10ms increase in page
load time costs the site $250K in revenue
annually.”
— Rob Trace, David Walp
Reference:http://blogs.msdn.com/b/ie/archive/2014/10/08/http-2-the-long-awaited-sequel.aspx
28. DON'T BELIEVE ME? LOOK AT THIS SNIPPET
var startTime = Date.now();
// A time consuming function
foo();
var test1 = Date.now();
// Another time consuming function
bar();
var test2 = Date.now();
// Prints the results
console.log("Test1: " + (test1 ‐ startTime));
console.log("Test2: " + (test2 ‐ test1));
29. WHAT'S WRONG WITH DATE.NOW()?
1. It is not monotonically increasing
2. Milliseconds precision
3. Precision of this timestamp varies between user agents
4. Different scope
65. DESKTOP BROWSERS SUPPORT
Explorer Chrome* Safari Firefox Opera*
10+ 14+(-webkit)
33+
6.1+ 10+(-moz)
18+
12.10+
15+(-webkit)
20+
Dataupdatedto18thApril2015
66. MOBILE BROWSERS SUPPORT
Explorer Android Chrome Safari Firefox Opera
10+ 4.4+(-webkit) 13+(-webkit)
33+
7.0+ 10+(-moz)
18+
None
Dataupdatedto18thApril2015
91. DESKTOP BROWSERS SUPPORT
Explorer Chrome Safari Firefox Opera
None 30+*
32+
None 11+(-moz)
16+
17+*
19+
Dataupdatedto18thApril2015
*YouhavetoactivatetheflagExperimentalWebPlatformfeatures
92. MOBILE BROWSERS SUPPORT
Explorer Android Chrome Safari Firefox Opera
None 4.4+ 30+*
32+
None 11+(-moz)
16+
None
Dataupdatedto18thApril2015
*YouhavetoactivatetheflagExperimentalWebPlatformfeatures
110. AMBIENT LIGHT API
Provides information about the ambient light level in terms of lux
units, as measured by a light sensor of a device.
0 ≤ value < 50: Dark environment, use light colors on a dark
background
50 ≤ value < 10000: Normal environment
value ≥ 10000: Very bright environment, use dark colors on a
light background
115. DO YOU LIKE APIS? OF COURSE YOU DO!
Device Orientation API
Geolocation API
Network Information API
Speech Synthesis API
Wake Lock API
Web Alarms API
Web Notification API
Web Speech API
...
116. TO LEARN MORE...
ABOUT THESE AND OTHER APIS
HTML5 API DEMOS
https://github.com/AurelioDeRosa/HTML5-API-demos
A repository I created and maintain where you can find
information about many JavaScript and HTML5 APIs.
117. CONCLUSIONS
Future of web development is bright
...but some browsers aren't prepared yet
Focus on goals, not technologies
Take care of performances
Take care of devices' resources
Take care of your users' experience