Skip to content

Commit ac3d15a

Browse files
committed
fix: usage in environment without window
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
1 parent 5aaa4ff commit ac3d15a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
/**
1+
/*!
22
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: GPL-3.0-or-later
44
*/
5+
56
import { loadState } from '@nextcloud/initial-state'
67

78
export function getCapabilities(): Object {
89
try {
910
return loadState('core', 'capabilities')
1011
} catch (error) {
1112
console.debug('Could not find capabilities initial state fall back to _oc_capabilities')
12-
if (!('_oc_capabilities' in window)) {
13+
if (!('_oc_capabilities' in globalThis)) {
1314
return {}
1415
}
15-
return window['_oc_capabilities'] as Object
16+
return globalThis['_oc_capabilities'] as Object
1617
}
1718
}

0 commit comments

Comments
 (0)