initial-state
/
2.1.0
initial-state 2.1.0
Install from the command line:
Learn more about npm packages
$ npm install @nextcloud/initial-state@2.1.0
Install via package.json:
"@nextcloud/initial-state": "2.1.0"
About this version
Access data from the server-side initial state API within apps.
npm install @nextcloud/initial-state --save
yarn add @nextcloud/initial-state
Check "Providing the initial state with PHP" for more details about initial state.
Note:
loadState
throws anError
if the key isn't found, hence you might want to wrap the call with atry
block.
import { loadState } from '@nextcloud/initial-state'
const val = loadState('myapp', 'user_preference')
// Provide a fallback value to return when the state is not found
const valWithFallback = loadState('myapp', 'user_preference', 'no_preference')
You can provide a type anotation for result.
import { loadState } from '@nextcloud/initial-state'
interface UserPreference {
refreshInterval: number
}
const val = loadState<UserPreference>('myapp', 'user_preference', {
refreshInterval: 15_000
})
Details
- initial-state
- nextcloud
- over 1 year ago
- GPL-3.0-or-later
- 7 dependencies
Assets
- initial-state-2.1.0.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0