Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 180b6b8

Browse files
author
Je
committed
feat: add useEnv hook
1 parent d5b3046 commit 180b6b8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hooks.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useContext, useEffect, useState } from 'https://esm.sh/react'
22
import { RouterContext } from './context.ts'
33
import { AsyncUseDenoError } from './error.ts'
44
import events from './events.ts'
5-
import type { RouterURL } from './types.ts'
5+
import type { AlephEnv, RouterURL } from './types.ts'
66

77
export function useRouter(): RouterURL {
88
return useContext(RouterContext)
@@ -52,3 +52,9 @@ export function useDeno<T = any>(callback: () => (T | Promise<T>), browser?: boo
5252

5353
return data
5454
}
55+
56+
export function useEnv(): AlephEnv {
57+
return useDeno<AlephEnv>(() => {
58+
return (globalThis as any).ALEPH.ENV
59+
})
60+
}

0 commit comments

Comments
 (0)