Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alisonmonteiro/change-title-onleave
Change the tab title once its visibility changes
https://github.com/alisonmonteiro/change-title-onleave
javascript page-title tabs visibility
Last synced: about 1 month ago
JSON representation
Change the tab title once its visibility changes
- Host: GitHub
- URL: https://github.com/alisonmonteiro/change-title-onleave
- Owner: alisonmonteiro
- Created: 2017-06-14T17:48:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-08T04:14:02.000Z (over 7 years ago)
- Last Synced: 2024-04-29T13:40:25.217Z (7 months ago)
- Topics: javascript, page-title, tabs, visibility
- Language: JavaScript
- Homepage:
- Size: 657 KB
- Stars: 15
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: change-title-onleave.js
Awesome Lists containing this project
README
## change-title-onleave
> Change the tab title on change its visibility
# ![change-title-onleave](media/example.gif)
### Install
You can get it on npm/yarn.
```
npm install change-title-onleave --save
```If you're not into package management, [download a ZIP file](https://github.com/alisonmonteiro/change-title-onleave/archive/master.zip).
### Usage
```html
```
Now, you need to instantiate it by passing an object as parameter;
```js
const options = {title: 'Hey! 👀', timeout: 1};
new ChangeTitleOnLeave(options);
```You can also `require` it:
```js
const changeTitle = require('change-title-onleave');
```### API
#### ChangeTitleOnLeave([options])
##### options
###### title
Type: `string`
A string with the title to apply on the tab
###### timeout
Type: `number`
Timeout between the transistion of titles
###### onHidden
Type: `function`
Is called when the user leaves the tab.
###### onVisible
Type: `function`
Is called when the user goes back to the tab.