SlideShare a Scribd company logo
web apis
you
didn’t know
existed
probably
@zenorocha
2008
2008
2009
2009
2010
2010
2011
2011
2012
2012
2013
2013
2014
2014
canvassvg
geolocation
local
storage
web
sockets
audio
video
drag &
drop
web rtc
page
visibility
Provides an API to ask
whether the current page
is visible or not.
page visibility
window.addEventListener('visibilitychange', () => {
if (document.hidden) {
console.log('Tab is hidden');
}
else {
console.log('Tab is focused');
}
});
page visibility
window.addEventListener('visibilitychange', () => {
switch(document.visibilityState) {
case 'prerender':
console.log('Tab is pre-rendering');
break;
case 'hidden':
console.log('Tab is hidden');
break;
case 'visible':
console.log('Tab is focused');
break;
}
});
caniuse.com/#feat=pagevisibility
BROWSER
support
where
to use it?
state
online
Exposes a network
connection availability
information to the web.
online state
console.log(navigator.onLine ? 'online' : 'offline')
online state
window.addEventListener('offline', networkStatus);
window.addEventListener('online', networkStatus);
function networkStatus(e) {
console.log(e.type);
}
online state
caniuse.com/#feat=online-status
BROWSER
support
where
to use it?
VIBRATION
Provides access to a
form of tactile feedback.
vibration
// Vibrate for 1 second
navigator.vibrate(1000);
// Vibrate with a pattern
navigator.vibrate([400, 300, 300, 200, 500]);
// Turn off vibration
navigator.vibrate(0);
VIBRATION
vibrate wait vibrate wait vibrate
// Super Mario
navigator.vibrate([125,75,125,275,200,275,125,75,125,27
5,200,600,200,600]);
// Star Wars
navigator.vibrate([500,110,500,110,450,110,200,110,170,
40,450,110,200,110,170,40,500]);
// Go Go Power Rangers
navigator.vibrate([150,150,150,150,75,75,150,150,150,15
0,450]);
VIBRATION
https://goo.gl/bX4ZQv
caniuse.com/#feat=vibration
BROWSER
support
where
to use it?
DEVICE
orientation
Provides access to device's
physical orientation.
device orientation
device orientation
window.addEventListener('deviceorientation', (e) => {
console.log(‘Gamma:’, e.gamma);
console.log(‘Beta:’, e.beta);
console.log(‘Alpha:’, e.alpha);
});
device orientation
let logo = document.querySelector(‘img');
window.addEventListener('deviceorientation', (e) => {
let tiltLR = e.gamma;
let tiltFB = e.beta;
logo.style.transform = `rotate(${tiltLR}deg)
rotate3d(1,0,0, ${tiltFB * -1}deg)`;
});
caniuse.com/#feat=deviceorientation
BROWSER
support
where
to use it?
clipboard
copy&paste
Standard APIs for
interacting with the
clipboard (copy/cut/paste).
clipboard
// 1. User interaction is required
let button = document.querySelector('button');
button.addEventListener('click', () => {
select();
copy();
});
clipboard
// 2. Programmatically select an element
function select() {
let input = document.querySelector('input');
input.focus();
input.setSelectionRange(0, input.value.length);
}
clipboard
// 3. Copy selected element text
function copy() {
try {
document.execCommand('copy');
}
catch (err) {
console.error(err);
}
}
clipboard
document.addEventListener('copy', (e) => {
console.log(e.target.value);
});
document.addEventListener('cut', (e) => {
console.log(e.target.value);
});
document.addEventListener('paste', (e) => {
console.log(e.clipboardData.getData('text/plain'));
});
clipboard
caniuse.com/#feat=clipboard
BROWSER
support
where
to use it?
light
ambient
Exposes sensor data that
captures the light intensity.
ambient light
window.addEventListener('devicelight', (e) => {
console.log(`${e.value} lux`);
});
ambient light
let sensor = new AmbientLightSensor();
sensor.start();
sensor.onchange = (e) => {
console.log(e.reading.illuminance);
};
sensor.stop();
ambient light sensor
BROWSER
caniuse.com/#feat=ambient-light
support
where
to use it?
STATUS
battery
Allows a web page to access
battery information from
desktop and mobile devices.
battery status
navigator.getBattery().then((battery) => {
console.log(`${battery.level * 100}%`);
battery.addEventListener('levelchange', () => {
console.log(`${this.level * 100}%`);
});
});
battery status
caniuse.com/#feat=battery-status
BROWSER
support
where
to use it?
web
components
templates
custom elements
shadow dom
html imports
progressive
web apps
service workers
push notifications
offline support
app manifest
background sync
WEBassembly
WebAssembly, or wasm,
is a low-level programming
language for the client-side.
web assembly
underdevelopm
ent
BROWSER
support
WEBVR
Experimental API that
provides access to Virtual
Reality devices, such as the
Oculus Rift or Google
Cardboard.
web VR
BROWSER
support
chromestatus.com/features#webvr
gamepad
Gives access to a game
controller via USB.
gamepad
window.addEventListener('gamepadconnected', () => {
let gp = navigator.getGamepads()[0];
console.log(‘ID:’, gp.id);
console.log(‘Axes:’, gp.axes.length);
console.log(‘Buttons:’, gp.buttons.length);
});
gamepad
window.addEventListener('gamepadconnected', gameLoop);
function gameLoop() {
let gp = navigator.getGamepads()[0];
if (gp.buttons[0].pressed) {
console.log('X');
}
requestAnimationFrame(gameLoop);
}
game loop
caniuse.com/#feat=gamepad
BROWSER
support
thank you
@zenorocha
so much

More Related Content

What's hot

Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
wpnepal
 
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobileFirefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Robert Nyman
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Pat Cito
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
benalman
 

What's hot (20)

Loadrunner
LoadrunnerLoadrunner
Loadrunner
 
Spine.js
Spine.jsSpine.js
Spine.js
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
 
Quality Use Of Plugin
Quality Use Of PluginQuality Use Of Plugin
Quality Use Of Plugin
 
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobileFirefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
 
18.register login
18.register login18.register login
18.register login
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
How to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrainHow to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrain
 
G* on GAE/J 挑戦編
G* on GAE/J 挑戦編G* on GAE/J 挑戦編
G* on GAE/J 挑戦編
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Clearance: Simple, complete Ruby web app authentication.
Clearance: Simple, complete Ruby web app authentication.Clearance: Simple, complete Ruby web app authentication.
Clearance: Simple, complete Ruby web app authentication.
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
2. 엔티티 매핑(entity mapping) 2 2 엔티티매핑 2-2-4. 식별자 자동 생성(@generated-value)3
2. 엔티티 매핑(entity mapping) 2 2 엔티티매핑 2-2-4. 식별자 자동 생성(@generated-value)32. 엔티티 매핑(entity mapping) 2 2 엔티티매핑 2-2-4. 식별자 자동 생성(@generated-value)3
2. 엔티티 매핑(entity mapping) 2 2 엔티티매핑 2-2-4. 식별자 자동 생성(@generated-value)3
 
YUI on the go
YUI on the goYUI on the go
YUI on the go
 
Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design Patterns
 
Automating Front-End Workflow
Automating Front-End WorkflowAutomating Front-End Workflow
Automating Front-End Workflow
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery Applications
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
 

Viewers also liked

Viewers also liked (20)

Desbravando o HTML5 Boilerplate
Desbravando o HTML5 BoilerplateDesbravando o HTML5 Boilerplate
Desbravando o HTML5 Boilerplate
 
Construindo Projetos Robustos em HTML5
Construindo Projetos Robustos em HTML5Construindo Projetos Robustos em HTML5
Construindo Projetos Robustos em HTML5
 
HTML 5
HTML 5HTML 5
HTML 5
 
Wordpress
WordpressWordpress
Wordpress
 
Web Components, A próxima revolução do desenvolvimento web.
Web Components, A próxima revolução do desenvolvimento web.Web Components, A próxima revolução do desenvolvimento web.
Web Components, A próxima revolução do desenvolvimento web.
 
Alabot
AlabotAlabot
Alabot
 
Getting started with YUI3 and AlloyUI
Getting started with YUI3 and AlloyUIGetting started with YUI3 and AlloyUI
Getting started with YUI3 and AlloyUI
 
Introdução ao HTML4 e HTML5
Introdução ao HTML4 e HTML5Introdução ao HTML4 e HTML5
Introdução ao HTML4 e HTML5
 
Como Perder Peso (no browser)
Como Perder Peso (no browser)Como Perder Peso (no browser)
Como Perder Peso (no browser)
 
How to create high scalable JavaScript apps for Java Portals
How to create high scalable JavaScript apps for Java PortalsHow to create high scalable JavaScript apps for Java Portals
How to create high scalable JavaScript apps for Java Portals
 
WTF Javascript - FrontInRio 2011
WTF Javascript - FrontInRio 2011WTF Javascript - FrontInRio 2011
WTF Javascript - FrontInRio 2011
 
Super Trunfo - Case de Dados Abertos
Super Trunfo - Case de Dados AbertosSuper Trunfo - Case de Dados Abertos
Super Trunfo - Case de Dados Abertos
 
Javascript Orientado a Objetos - Fisl12
Javascript Orientado a Objetos - Fisl12Javascript Orientado a Objetos - Fisl12
Javascript Orientado a Objetos - Fisl12
 
Augmented Reality in JavaScript
Augmented Reality in JavaScriptAugmented Reality in JavaScript
Augmented Reality in JavaScript
 
It's Javascript Time
It's Javascript TimeIt's Javascript Time
It's Javascript Time
 
Aula javascript
Aula  javascriptAula  javascript
Aula javascript
 
Um pequeno estudo sobre a microsoft
Um pequeno estudo sobre a microsoftUm pequeno estudo sobre a microsoft
Um pequeno estudo sobre a microsoft
 
Javascript para adultos
Javascript para adultosJavascript para adultos
Javascript para adultos
 
Os mitos do desenvolvimento front-end
Os mitos do desenvolvimento front-endOs mitos do desenvolvimento front-end
Os mitos do desenvolvimento front-end
 
Future of Web Development
Future of Web DevelopmentFuture of Web Development
Future of Web Development
 

Similar to Web APIs you (probably) didn't know existed

The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
rajivmordani
 
HTML5: huh, what is it good for?
HTML5: huh, what is it good for?HTML5: huh, what is it good for?
HTML5: huh, what is it good for?
Remy Sharp
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication development
Ganesh Gembali
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
Remy Sharp
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
PL dream
 
HTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - AltranHTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - Altran
Robert Nyman
 

Similar to Web APIs you (probably) didn't know existed (20)

Dojo and Adobe AIR
Dojo and Adobe AIRDojo and Adobe AIR
Dojo and Adobe AIR
 
Functional testing with capybara
Functional testing with capybaraFunctional testing with capybara
Functional testing with capybara
 
How to use lekhoniya.pdf
How to use lekhoniya.pdfHow to use lekhoniya.pdf
How to use lekhoniya.pdf
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
Protractor Training in Pune by QuickITDotnet
Protractor Training in Pune by QuickITDotnet Protractor Training in Pune by QuickITDotnet
Protractor Training in Pune by QuickITDotnet
 
Protractor Training - Online training On Skype
Protractor Training - Online training On Skype Protractor Training - Online training On Skype
Protractor Training - Online training On Skype
 
Mashing up JavaScript
Mashing up JavaScriptMashing up JavaScript
Mashing up JavaScript
 
HTML5: huh, what is it good for?
HTML5: huh, what is it good for?HTML5: huh, what is it good for?
HTML5: huh, what is it good for?
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication development
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Asynchronous Programming at Netflix
Asynchronous Programming at NetflixAsynchronous Programming at Netflix
Asynchronous Programming at Netflix
 
Mashing up JavaScript – Advanced Techniques for modern Web Apps
Mashing up JavaScript – Advanced Techniques for modern Web AppsMashing up JavaScript – Advanced Techniques for modern Web Apps
Mashing up JavaScript – Advanced Techniques for modern Web Apps
 
HTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - AltranHTML5 APIs - Where no man has gone before! - Altran
HTML5 APIs - Where no man has gone before! - Altran
 
mobl
moblmobl
mobl
 
jQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyjQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journey
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 

Web APIs you (probably) didn't know existed