1.0.0 • Published 4 years ago

unfocused v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Unfocused

A tiny NPM package to update the page title when the tab isn't focused

Changelog

Demo

You can see a demo of it over here!

unfocused

Installation and usage

Install the package

npm install unfocused --save

Implement it

import Unfocused from 'unfocused';

const unfocused = new Unfocused({
  blurTitle: "I'm blurred!",
  focusTitle: "I'm in focus!",
});
import React, {useEffect} from 'react';
import Unfocused from 'unfocused';

const App = () => {
  useEffect(() => {
    const unfocused = new Unfocused({
      blurTitle: "I'm blurred!",
      focusTitle: "I'm in focus!",
    });
    return () => {
      unfocused.destroy();
    };
  }, []);

  return <div />;
};

API

NameTypeDefaultDescription
InstantiateObjectAn object containing blurTitle and and optional focusTitle
blurTitleStringThe page title to display when the page is blurred
focusTitleStringdocument.titleThe page title to display when the page is focused, if none provided, the current title will be used
destroyFunctionMethod to call to remove the event listener

Browser support

  • Chrome
  • Firefox
  • Safari
  • IE10
  • Edge

Development

1. yarn install
2. yarn dev

Building the project

1. yarn install
2. yarn build

Contributing

For bugs and feature requests, please open an issue. If you'd like to contribute, create a new PR with your changes. Make sure you update the changelog (if applicable).

1.0.0

4 years ago

0.2.0

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago