Buy Me A Coffee 😇

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
Apr. 15, 2023. 2:57 PM

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])

If you enjoy this article and would like to show your support, you can easily do so by making a donation through Ko-fi. Your contribution is greatly appreciated!

Buy Me a Coffee at ko-fi.com
BroJenuel
Hi! 👋 Im Jenuel. Since the beginning of my journey as a software developer 6 years ago, I've done office and remote work for companies, and collaborated with teams of developers to build and maintain awesome products. I'm quietly confident, naturally curious, and perpetually working on improving my craft.
Living, learning, & leveling up one day at a time.
Hand Crafted by Me @ 2023