Skip to content

Commit 73b8659

Browse files
authored
Merge pull request #6912 from nextcloud-libraries/backport/6659/stable8
[stable8] refactor(useIsFullscreen): migrate to Typescript
2 parents ab74f95 + 5e60d6e commit 73b8659

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/composables/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
export * from './useIsFullscreen/index.js'
7-
export * from './useIsMobile/index.js'
86
export * from './useFormatDateTime.ts'
97
export * from './useHotKey/index.js'
108
export * from './useIsDarkTheme/index.ts'
9+
export * from './useIsFullscreen/index.ts'
10+
export * from './useIsMobile/index.js'

src/composables/useIsFullscreen/index.js renamed to src/composables/useIsFullscreen/index.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
5+
import type { DeepReadonly, Ref } from 'vue'
66
import { readonly, ref } from 'vue'
77

8-
// if the window height is equal to the screen height,
9-
// we're in full screen mode
10-
const checkIfIsFullscreen = () => window.outerHeight === screen.height
11-
128
const isFullscreen = ref(checkIfIsFullscreen())
139

1410
window.addEventListener('resize', () => {
1511
isFullscreen.value = checkIfIsFullscreen()
1612
})
1713

1814
/**
19-
* Use global isFullscreen state, based on the screen height check
20-
*
21-
* @return {import('vue').DeepReadonly<import('vue').Ref<boolean>>}
15+
* If the window height is equal to the screen height,
16+
* we are in full screen mode.
17+
*/
18+
function checkIfIsFullscreen(): boolean {
19+
return window.outerHeight === window.screen.height
20+
}
21+
22+
/**
23+
* Use global `isFullscreen` state, based on the screen height check.
2224
*/
23-
export function useIsFullscreen() {
25+
export function useIsFullscreen(): DeepReadonly<Ref<boolean>> {
2426
return readonly(isFullscreen)
2527
}
2628

src/mixins/isFullscreen/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import { isFullscreenState } from '../../composables/useIsFullscreen/index.js'
6+
import { isFullscreenState } from '../../composables/useIsFullscreen/index.ts'
77

88
export default {
99
computed: {

0 commit comments

Comments
 (0)