mirror of
https://github.com/koel/koel
synced 2024-11-24 21:23:06 +00:00
11 lines
327 B
TypeScript
11 lines
327 B
TypeScript
import { RouterKey } from '@/symbols'
|
|
import { requireInjection } from '@/utils'
|
|
|
|
export const useScreen = (screen: ScreenName) => {
|
|
const router = requireInjection(RouterKey)
|
|
const onScreenActivated = (cb: Closure) => router.onRouteChanged(route => route.screen === screen && cb())
|
|
|
|
return {
|
|
onScreenActivated
|
|
}
|
|
}
|