25. // 1. User interaction is REQUIRED!
const button = document.querySelector('#copy');
button.addEventListener('click', function() {
select();
copy();
});
26. // 2. Select content of the element, programmatically
function select() {
const text = document.querySelector('#source');
text.focus();
text.setSelectionRange(0, text.value.length);
}
27. // 3. Copy selected element text
function copy() {
try {
document.execCommand('copy');
} catch(err) {
console.error(err);
}
}
43. 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;
}
});
59. • Masih banyak fitur HTML5 yang belum
dieksplorasi
• Web menjadi platform yang semakin
menjanjikan
• Web menjadi semakin mendekati fitur-
fitur aplikasi native
• Project Fugu