Skip to content

Commit

Permalink
fix(ssr-handlers): compatible with QQ browser (vitest-dev#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea authored Jan 7, 2022
1 parent 65acbfc commit 7dac4f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/ssr-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ export interface SSRHandlersMap {
updateHTMLAttrs: (selector: string, attribute: string, value: string) => void
}

const _global = globalThis || this

const globalKey = '__vueuse_ssr_handlers__'
// @ts-expect-error
globalThis[globalKey] = globalThis[globalKey] || {}
_global[globalKey] = _global[globalKey] || {}
// @ts-expect-error
const handlers: Partial<SSRHandlersMap> = globalThis[globalKey]
const handlers: Partial<SSRHandlersMap> = _global[globalKey]

export function getSSRHandler<T extends keyof SSRHandlersMap>(key: T, fallback: SSRHandlersMap[T]): SSRHandlersMap[T]
export function getSSRHandler<T extends keyof SSRHandlersMap>(key: T, fallback: SSRHandlersMap[T] | undefined): SSRHandlersMap[T] | undefined
Expand Down

0 comments on commit 7dac4f8

Please sign in to comment.