source: imaps-frontend/node_modules/react-use/esm/useTitle.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 661 bytes
Line 
1import { useEffect, useRef } from 'react';
2var DEFAULT_USE_TITLE_OPTIONS = {
3 restoreOnUnmount: false,
4};
5function useTitle(title, options) {
6 if (options === void 0) { options = DEFAULT_USE_TITLE_OPTIONS; }
7 var prevTitleRef = useRef(document.title);
8 if (document.title !== title)
9 document.title = title;
10 useEffect(function () {
11 if (options && options.restoreOnUnmount) {
12 return function () {
13 document.title = prevTitleRef.current;
14 };
15 }
16 else {
17 return;
18 }
19 }, []);
20}
21export default typeof document !== 'undefined' ? useTitle : function (_title) { };
Note: See TracBrowser for help on using the repository browser.