SlideShare a Scribd company logo
1 of 60
Download to read offline
Beberapa WEB Browser
API Menarik
Halo, saya Riza!
HTML5
2008
2009
2014
2020
Sudahkah Kita Mencoba
Fitur-fitur HTML5?
SVG
Canvas
LocalStorage
WebRTC
Socket
Audio Video
Geolocation
Ambient Light
Ambient Light
Menampilkan data dari sensor cahaya atau
kamera/webcam.
if ('ondevicelight' in window) {
window.addEventListener('devicelight', function(event) {
console.log(event.value);
});
} else {
console.log('devicelight event not supported');
}
Dukungan Browser
https://caniuse.com/#feat=ambient-light
Contoh Penggunaan
Battery Status
Battery Status
Memungkinkan aplikasi web untuk
mendapatkan informasi status baterai
laptop ataupun ponsel.
navigator.getBattery().then(function (battery) {
console.log(battery.level)
battery.addEventListener('levelchange', function () {
console.log(`${Math.floor(this.level * 100)}%`);
});
});
Dukungan Browser
https://caniuse.com/#feat=battery-status
Contoh Penggunaan
Contoh Penggunaan
Clipboard
Clipboard
Antarmuka untuk berinteraksi dengan
clipboard atau copy-paste.
// 1. User interaction is REQUIRED!
const button = document.querySelector('#copy');
button.addEventListener('click', function() {
select();
copy();
});
// 2. Select content of the element, programmatically
function select() {
const text = document.querySelector('#source');
text.focus();
text.setSelectionRange(0, text.value.length);
}
// 3. Copy selected element text
function copy() {
try {
document.execCommand('copy');
} catch(err) {
console.error(err);
}
}
Dukungan Browser
https://caniuse.com/#search=clipboard
Contoh Penggunaan
Device Orientation
Device Orientation
Menyediakan informasi orientasi dari
perangkat yang digunakan.
window.addEventListener('deviceorientation',
function (e) {
console.log(`Alpha: ${e.alpha}`);
console.log(`Gamma: ${e.gamma}`);
console.log(`Beta: ${e.beta}`);
});
Dukungan Browser
https://caniuse.com/#feat=deviceorientation
Contoh Penggunaan
Contoh Penggunaan
Online Status
Online Status
Menyediakan informasi jaringan yang
digunakan untuk membuka halaman web.
// Online Status
console.log(navigator.onLine ? 'Online 🎉' : 'Offline 😢' );
window.addEventListener('offline', printNetworkStatus);
window.addEventListener('online', printNetworkStatus);
function printNetworkStatus(e) {
console.log(e.type);
}
Dukungan Browser
https://caniuse.com/#feat=online-status
Contoh Penggunaan
Page Visibility
Page Visibility
Menyediakan antarmuka untuk mengetahui
apakah sebuah halaman dilihat oleh
pengguna atau tidak.
window.addEventListener('visibilitychange', function() {
switch (document.visibilityState) {
case 'prerender':
console.log('Tab is prerendering...');
break;
case 'hidden':
console.log('Tab is hidden.');
break;
case 'visible':
console.log('Tab is focused.');
break;
}
});
Dukungan Browser
https://caniuse.com/#feat=pagevisibility
Contoh Penggunaan
Vibration
Vibration
Menyediakan umpan balik kepada pengguna
dalam bentuk getaran.
// Vibrate for a second.
navigator.vibrate(1000);
// Vibrate with a pattern
navigator.vibrate([400, 300, 300, 200, 500]);
// Turn off vibration
navigator.vibrate(0);
vibrate vibrate vibratewait wait
// Super Mario
navigator.vibrate([125,75,125,275,200,275,125,75,
125,275,200,600,200,600]);
// Star Wars
navigator.vibrate([500,110,500,110,450,110,200,11
0,170,40,450,110,200,110,170,40,500]);
// Power Rangers
navigator.vibrate([150,150,150,150,75,75,150,150,
150,150,450]);
https://goo.gl/bX4ZQv
Dukungan Browser
https://caniuse.com/#feat=vibration
Contoh Penggunaan
Contoh Penggunaan
Masih Banyak Yang
Lainnya!
Templates
Web Components
Shadow DOM
HTML Imports
Custom Elements
Service Workers
Progressive Web Apps
App ManifestPush Notification
Background Sync
Offline Support
WebAssembly
Wasm Module Emscripten
Threads Garbage Collector
https://beta.unity3d.com/jonas/AngryBots/
Kesimpulan
• Masih banyak fitur HTML5 yang belum
dieksplorasi
• Web menjadi platform yang semakin
menjanjikan
• Web menjadi semakin mendekati fitur-
fitur aplikasi native
• Project Fugu
https://web.dev/fugu-status/

More Related Content

More from Riza Fahmi

Membangun Aplikasi Web dengan Elixir dan Phoenix
Membangun Aplikasi Web dengan Elixir dan PhoenixMembangun Aplikasi Web dengan Elixir dan Phoenix
Membangun Aplikasi Web dengan Elixir dan PhoenixRiza Fahmi
 
Berbagai Pilihan Karir Developer
Berbagai Pilihan Karir DeveloperBerbagai Pilihan Karir Developer
Berbagai Pilihan Karir DeveloperRiza Fahmi
 
Web dan Progressive Web Apps di 2020
Web dan Progressive Web Apps di 2020Web dan Progressive Web Apps di 2020
Web dan Progressive Web Apps di 2020Riza Fahmi
 
Remote Working/Learning
Remote Working/LearningRemote Working/Learning
Remote Working/LearningRiza Fahmi
 
How to learn programming
How to learn programmingHow to learn programming
How to learn programmingRiza Fahmi
 
Rapid App Development with AWS Amplify
Rapid App Development with AWS AmplifyRapid App Development with AWS Amplify
Rapid App Development with AWS AmplifyRiza Fahmi
 
Menguak Misteri Module Bundler
Menguak Misteri Module BundlerMenguak Misteri Module Bundler
Menguak Misteri Module BundlerRiza Fahmi
 
MVP development from software developer perspective
MVP development from software developer perspectiveMVP development from software developer perspective
MVP development from software developer perspectiveRiza Fahmi
 
Ekosistem JavaScript di Indonesia
Ekosistem JavaScript di IndonesiaEkosistem JavaScript di Indonesia
Ekosistem JavaScript di IndonesiaRiza Fahmi
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonMLRiza Fahmi
 
How I Generate Idea
How I Generate IdeaHow I Generate Idea
How I Generate IdeaRiza Fahmi
 
Strategi Presentasi Untuk Developer Workshop Slide
Strategi Presentasi Untuk Developer Workshop SlideStrategi Presentasi Untuk Developer Workshop Slide
Strategi Presentasi Untuk Developer Workshop SlideRiza Fahmi
 
Lesson Learned from Prolific Developers
Lesson Learned from Prolific DevelopersLesson Learned from Prolific Developers
Lesson Learned from Prolific DevelopersRiza Fahmi
 
Clean Code JavaScript
Clean Code JavaScriptClean Code JavaScript
Clean Code JavaScriptRiza Fahmi
 
The Future of AI
The Future of AIThe Future of AI
The Future of AIRiza Fahmi
 
Chrome Dev Summit 2018 - Personal Take Aways
Chrome Dev Summit 2018 - Personal Take AwaysChrome Dev Summit 2018 - Personal Take Aways
Chrome Dev Summit 2018 - Personal Take AwaysRiza Fahmi
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Riza Fahmi
 
Modern Static Site with GatsbyJS
Modern Static Site with GatsbyJSModern Static Site with GatsbyJS
Modern Static Site with GatsbyJSRiza Fahmi
 
Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonMLRiza Fahmi
 
Machine learning with py torch
Machine learning with py torchMachine learning with py torch
Machine learning with py torchRiza Fahmi
 

More from Riza Fahmi (20)

Membangun Aplikasi Web dengan Elixir dan Phoenix
Membangun Aplikasi Web dengan Elixir dan PhoenixMembangun Aplikasi Web dengan Elixir dan Phoenix
Membangun Aplikasi Web dengan Elixir dan Phoenix
 
Berbagai Pilihan Karir Developer
Berbagai Pilihan Karir DeveloperBerbagai Pilihan Karir Developer
Berbagai Pilihan Karir Developer
 
Web dan Progressive Web Apps di 2020
Web dan Progressive Web Apps di 2020Web dan Progressive Web Apps di 2020
Web dan Progressive Web Apps di 2020
 
Remote Working/Learning
Remote Working/LearningRemote Working/Learning
Remote Working/Learning
 
How to learn programming
How to learn programmingHow to learn programming
How to learn programming
 
Rapid App Development with AWS Amplify
Rapid App Development with AWS AmplifyRapid App Development with AWS Amplify
Rapid App Development with AWS Amplify
 
Menguak Misteri Module Bundler
Menguak Misteri Module BundlerMenguak Misteri Module Bundler
Menguak Misteri Module Bundler
 
MVP development from software developer perspective
MVP development from software developer perspectiveMVP development from software developer perspective
MVP development from software developer perspective
 
Ekosistem JavaScript di Indonesia
Ekosistem JavaScript di IndonesiaEkosistem JavaScript di Indonesia
Ekosistem JavaScript di Indonesia
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
 
How I Generate Idea
How I Generate IdeaHow I Generate Idea
How I Generate Idea
 
Strategi Presentasi Untuk Developer Workshop Slide
Strategi Presentasi Untuk Developer Workshop SlideStrategi Presentasi Untuk Developer Workshop Slide
Strategi Presentasi Untuk Developer Workshop Slide
 
Lesson Learned from Prolific Developers
Lesson Learned from Prolific DevelopersLesson Learned from Prolific Developers
Lesson Learned from Prolific Developers
 
Clean Code JavaScript
Clean Code JavaScriptClean Code JavaScript
Clean Code JavaScript
 
The Future of AI
The Future of AIThe Future of AI
The Future of AI
 
Chrome Dev Summit 2018 - Personal Take Aways
Chrome Dev Summit 2018 - Personal Take AwaysChrome Dev Summit 2018 - Personal Take Aways
Chrome Dev Summit 2018 - Personal Take Aways
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6
 
Modern Static Site with GatsbyJS
Modern Static Site with GatsbyJSModern Static Site with GatsbyJS
Modern Static Site with GatsbyJS
 
Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonML
 
Machine learning with py torch
Machine learning with py torchMachine learning with py torch
Machine learning with py torch
 

Beberapa Web API Menarik