Change the tab title on change its visibility
You can get it on npm/yarn.
npm install change-title-onleave --save
If you're not into package management, download a ZIP file.
<script src="change-title-onleave.min.js"></script>
Now, you need to instantiate it by passing an object as parameter;
const options = {title: 'Hey! 👀', timeout: 1};
new ChangeTitleOnLeave(options);
You can also require
it:
const changeTitle = require('change-title-onleave');
Type: string
A string with the title to apply on the tab
Type: number
Timeout between the transistion of titles
onHidden
Type: function
Is called when the user leaves the tab.
Type: function
Is called when the user goes back to the tab.