5 JavaScript Web APIs you may not know
Here are 5 JavaScript Web APIs that you may not know. These APIs are going to be useful.
#javascript
#api
#web
✍️
jenuel.dev
Apr. 15, 2023. 2:57 PM
Ads
Clipboard API
allows copying content to and reading content from the device clipboard.
navigator.clipboard.writeText('hellow world')\
.then(() => { /** success */ })
navigator.clipboard.readText()
.then(text => { /** success */ })
Media Capture
Allows using the device camera and reading the screen content (screen share)
navigator.mediaDevices
.getUserMedia({
video: true,
audio: false
}).then(stream => {
/** Use stream of video */
})
Animations API
Programmatically create animations in a style that is similar to CSS keyframes.
const keyframes = [
{
color: '#000000',
},
{
color: '#431236'
}
];
const options = [
duration: 3000, iterations: Infinity,
];
document.getElementById('item')
.animate(keyframes, options);
Share API
Triggers the OS share widget to share content through other applications.
navigator.share({
title: 'My Blog',
text: 'Check out my cool blog',
url: 'https://brojenuel.com/blog/the-greatest-blog'
})
Vibration API
Makes the device vibrate on a given pattern (only if the device supports)
window.navigator.vibrate([200, 50, 200])