Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@nextcloud/initial-state

Package Overview
Dependencies
Maintainers
13
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextcloud/initial-state

Access data from the nextcloud server-side initial state API within apps.

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
38K
26.09%
Maintainers
13
Weekly downloads
 
Created
Source

@nextcloud/initial-state

REUSE status npm Test status Code coverage Documentation

Access data from the server-side initial state API within apps.

Installation

npm install @nextcloud/initial-state --save
yarn add @nextcloud/initial-state

Usage

Check "Providing the initial state with PHP" for more details about initial state.

Note: loadState throws an Error if the key isn't found, hence you might want to wrap the call with a try 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
})

Keywords

nextcloud

FAQs

Package last updated on 01 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts