diff options
Diffstat (limited to 'core/src/OCP')
-rw-r--r-- | core/src/OCP/index.js | 9 | ||||
-rw-r--r-- | core/src/OCP/initialstate.js | 17 |
2 files changed, 9 insertions, 17 deletions
diff --git a/core/src/OCP/index.js b/core/src/OCP/index.js index 7d5edd5a9d0..3309e3fe047 100644 --- a/core/src/OCP/index.js +++ b/core/src/OCP/index.js @@ -3,8 +3,8 @@ */ import * as AppConfig from './appconfig' import * as Comments from './comments' -import * as InitialState from './initialstate' import Loader from './loader' +import { loadState } from '@nextcloud/initial-state' import Collaboration from './collaboration' import Toast from './toast' import * as WhatsNew from './whatsnew' @@ -14,7 +14,12 @@ export default { AppConfig, Collaboration, Comments, - InitialState, + InitialState: { + /** + * @deprecated 18.0.0 add https://www.npmjs.com/package/@nextcloud/initial-state to your app + */ + loadState + }, Loader, Toast, WhatsNew diff --git a/core/src/OCP/initialstate.js b/core/src/OCP/initialstate.js index 0a6f364ed00..57a1162bedb 100644 --- a/core/src/OCP/initialstate.js +++ b/core/src/OCP/initialstate.js @@ -24,19 +24,6 @@ * @namespace OCP.InitialState */ -export function loadState(app, key) { - const elem = document.querySelector(`#initial-state-${app}-${key}`) - if (elem === null) { - const msg = `Could not find initial state ${key} of ${app}` - console.debug(msg) - throw new Error(msg) - } +import { loadState as load } from '@nextcloud/initial-state' - try { - return JSON.parse(atob(elem.value)) - } catch (e) { - const msg = `Could not parse initial state ${key} of ${app}` - console.debug(msg) - throw new Error(msg) - } -} +export const loadState = load |