This repository was archived by the owner on Jul 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import events from "./events.ts";
4
4
let routerReady = false ;
5
5
let preRedirect : URL | null = null ;
6
6
7
+ const deno = typeof Deno === "object" && Deno !== null && typeof Deno . env === "object" ;
8
+
7
9
const onrouterready = ( _ : Record < string , unknown > ) => {
8
10
events . off ( "routerready" , onrouterready ) ;
9
11
if ( preRedirect ) {
@@ -15,12 +17,12 @@ const onrouterready = (_: Record<string, unknown>) => {
15
17
events . on ( "routerready" , onrouterready ) ;
16
18
17
19
export function redirect ( url : string , replace ?: boolean ) {
18
- const { location } = window ;
19
-
20
- if ( ! util . isFilledString ( url ) ) {
20
+ if ( ! util . isFilledString ( url ) || deno ) {
21
21
return ;
22
22
}
23
23
24
+ const { location } = window ;
25
+
24
26
if ( util . isLikelyHttpURL ( url ) || url . startsWith ( "file://" ) || url . startsWith ( "mailto:" ) || url . startsWith ( "data:" ) ) {
25
27
location . href = url ;
26
28
return ;
Original file line number Diff line number Diff line change 1
- const deno = typeof Deno !== "undefined" && typeof Deno . env === "object" ;
1
+ const deno = typeof Deno === "object" && Deno !== null && typeof Deno . env === "object" ;
2
2
3
3
export function applyCSS ( url : string , css : string ) {
4
4
if ( ! deno ) {
You can’t perform that action at this time.
0 commit comments