-
Notifications
You must be signed in to change notification settings - Fork 39
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
Showing
6 changed files
with
51 additions
and
4 deletions.
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
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
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 |
---|---|---|
@@ -1,9 +1,42 @@ | ||
import VConsole from 'vconsole'; | ||
import util from "../utils/util"; | ||
|
||
export const useApp = () => { | ||
export function useApp() { | ||
const _env = util.getEnv() | ||
if(_env.DEV) { | ||
new VConsole() | ||
} | ||
|
||
const plausibleSrc = _env.PLAUSIBLE_SRC | ||
const plausibleDomain = _env.PLAUSIBLE_DOMAIN | ||
if(plausibleSrc && plausibleDomain) { | ||
loadScript(plausibleSrc, [{ key: "data-domain", val: plausibleDomain }]) | ||
} | ||
} | ||
|
||
|
||
interface AttrAtom { | ||
key: string | ||
val: string | ||
} | ||
|
||
function loadScript( | ||
src: string, | ||
attrs: AttrAtom[] = [], | ||
) { | ||
|
||
const scriptEl = document.createElement('script') | ||
scriptEl.type = "text/javascript" | ||
scriptEl.src = src | ||
|
||
for(let i=0; i<attrs.length; i++) { | ||
const v = attrs[i] | ||
scriptEl.setAttribute(v.key, v.val) | ||
} | ||
scriptEl.defer = true | ||
|
||
const headEl = document.querySelector("head") | ||
if(!headEl) return | ||
|
||
headEl.appendChild(scriptEl) | ||
} |
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
1831701
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
podcast-together – ./
podcast-together-git-main-yenche123.vercel.app
podcast-together-neon.vercel.app
podcastogether.com
podcast-together-yenche123.vercel.app
www.podcastogether.com