Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goto-bus-stop/flash-document-title
flash a notification message in the tab title area
https://github.com/goto-bus-stop/flash-document-title
Last synced: 27 days ago
JSON representation
flash a notification message in the tab title area
- Host: GitHub
- URL: https://github.com/goto-bus-stop/flash-document-title
- Owner: goto-bus-stop
- License: other
- Created: 2017-12-17T13:38:31.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-01T11:06:14.000Z (over 3 years ago)
- Last Synced: 2024-10-06T16:01:25.619Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/flash-document-title
- Size: 5.86 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# flash-document-title
Flash a notification message in the tab title area.
If the tab is hidden, this module prepends the given argument before the current document title.
Each second, it animates by prepending and removing a `! ` character.
Once the tab is no longer hidden, the document title is reset.![screenshot](https://i.imgur.com/llB1hvQ.png)
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url][npm-image]: https://img.shields.io/npm/v/flash-document-title.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/flash-document-title
[travis-image]: https://img.shields.io/travis/goto-bus-stop/flash-document-title.svg?style=flat-square
[travis-url]: https://travis-ci.org/goto-bus-stop/flash-document-title
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard## Install
```
npm install flash-document-title
```## Usage
```js
var flashDocumentTitle = require('flash-document-title')flashDocumentTitle('💬 someone said something!')
```Easily use it in choo views by creating a store that adds an event listener:
```js
var app = choo()
app.use(flashStore)
function flashStore (state, emitter) {
emitter.on('notify', flashDocumentTitle)
}app.route('/', function (state, emit) {
return html`
Notify me soon
`
function onclick () {
setTimeout(function () { emit('notify', 'NOTIFICATION TIME!') }, 5000)
}
})
app.mount('body')
```## License
[Apache-2.0](LICENSE.md)