title-utils.js 407 B

12345678910111213141516171819
  1. const STANDALONE_TITLE = 'Weave Scope';
  2. const STANDALONE = document.title === STANDALONE_TITLE;
  3. const SEPARATOR = ' – ';
  4. export function setDocumentTitle(title) {
  5. if (!STANDALONE) {
  6. return;
  7. }
  8. if (title) {
  9. document.title = [STANDALONE_TITLE, title].join(SEPARATOR);
  10. } else {
  11. document.title = STANDALONE_TITLE;
  12. }
  13. }
  14. export function resetDocumentTitle() {
  15. setDocumentTitle(null);
  16. }