Skip to content

[stable8] refactor(useIsFullscreen): migrate to Typescript #6912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/composables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

export * from './useIsFullscreen/index.js'
export * from './useIsMobile/index.js'
export * from './useFormatDateTime.ts'
export * from './useHotKey/index.js'
export * from './useIsDarkTheme/index.ts'
export * from './useIsFullscreen/index.ts'
export * from './useIsMobile/index.js'
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import type { DeepReadonly, Ref } from 'vue'
import { readonly, ref } from 'vue'

// if the window height is equal to the screen height,
// we're in full screen mode
const checkIfIsFullscreen = () => window.outerHeight === screen.height

const isFullscreen = ref(checkIfIsFullscreen())

window.addEventListener('resize', () => {
isFullscreen.value = checkIfIsFullscreen()
})

/**
* Use global isFullscreen state, based on the screen height check
*
* @return {import('vue').DeepReadonly<import('vue').Ref<boolean>>}
* If the window height is equal to the screen height,
* we are in full screen mode.
*/
function checkIfIsFullscreen(): boolean {
return window.outerHeight === window.screen.height
}

/**
* Use global `isFullscreen` state, based on the screen height check.
*/
export function useIsFullscreen() {
export function useIsFullscreen(): DeepReadonly<Ref<boolean>> {
return readonly(isFullscreen)
}

Expand Down
2 changes: 1 addition & 1 deletion src/mixins/isFullscreen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { isFullscreenState } from '../../composables/useIsFullscreen/index.js'
import { isFullscreenState } from '../../composables/useIsFullscreen/index.ts'

export default {
computed: {
Expand Down
Loading