-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f71d28
commit f79a7aa
Showing
4 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
export const useDocumentTitle = () => { | ||
$effect(() => { | ||
let pattern = 0 | ||
|
||
const emptyTitle = '_______________'.split('') | ||
const title1 = '_____zesty_____'.split('') | ||
const title2 = '____p_l_u_s____'.split('') | ||
|
||
const pattern1 = () => { | ||
const last = title1.pop() | ||
title1.unshift(last!) | ||
document.title = title1.join('') | ||
} | ||
|
||
const pattern2 = () => { | ||
document.title = | ||
document.title === emptyTitle.join('') | ||
? title2.join('') | ||
: emptyTitle.join('') | ||
} | ||
|
||
const patterns = [pattern1, pattern2] | ||
|
||
const id1 = setInterval(() => { | ||
patterns[pattern]() | ||
}, 300) | ||
|
||
const id2 = setInterval(() => { | ||
pattern = pattern === 0 ? 1 : 0 | ||
}, 2000) | ||
|
||
return () => { | ||
clearInterval(id1) | ||
clearInterval(id2) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.