Padloc Logo Docs & Resources

Class: AppState

app.AppState

Application state

Hierarchy

Constructors

constructor

new AppState()

Inherited from

Storable.constructor

Properties

_errors

_errors: Err[] = []

Defined in

core/src/app.ts:211


_propertySerializationOptions

_propertySerializationOptions: SerializationOptions[]

Inherited from

Storable._propertySerializationOptions

Defined in

core/src/encoding.ts:163


account

account: null | Account = null

Currently logged in Account

Defined in

core/src/app.ts:175


authInfo

authInfo: null | AuthInfo = null

Authentication Information, such as active sessions, trusted devices etc.

Defined in

core/src/app.ts:179


context

context: AppContext = {}

Defined in

core/src/app.ts:198


device

device: DeviceInfo

Info about current device

Defined in

core/src/app.ts:167


id

id: string = "app-state"

Overrides

Storable.id

Defined in

core/src/app.ts:155


index

index: Index

Defined in

core/src/app.ts:201


lastUsed

lastUsed: Map<string, Date>

IDs of most recently used items. The most recently used item is last

Defined in

core/src/app.ts:209


offline

offline: boolean = false

Whether the app doesn't have an internet connection at the moment

Defined in

core/src/app.ts:193


orgs

orgs: Org[] = []

All organizations the current account is a member of.

Defined in

core/src/app.ts:183


rememberedMasterKey

rememberedMasterKey: null | StoredMasterKey = null

Defined in

core/src/app.ts:196


session

session: null | Session = null

Current Session

Defined in

core/src/app.ts:171


settings

settings: Settings

Application Settings

Defined in

core/src/app.ts:159


stats

stats: Stats

Usage data

Defined in

core/src/app.ts:163


syncing

syncing: boolean = false

Whether a sync is currently in process.

Defined in

core/src/app.ts:190


vaults

vaults: Vault[] = []

All vaults the current account has access to.

Defined in

core/src/app.ts:187

Accessors

kind

get kind(): string

A string representing the objects "type", useful for segmenting storage, among other things. Defaults to the lowercase class name, but can be overwritten by subclasses

Returns

string

Inherited from

Storable.kind

Defined in

core/src/encoding.ts:159


locked

get locked(): boolean

Whether the app is in "locked" state

Returns

boolean

Defined in

core/src/app.ts:233


loggedIn

get loggedIn(): boolean

Whether a user is logged in

Returns

boolean

Defined in

core/src/app.ts:238


tags

get tags(): [string, number][]

All Tags found within the users Vaults

Returns

[string, number][]

Defined in

core/src/app.ts:214

Methods

_fromRaw

Protected _fromRaw(raw): void

Restore values from a raw object. The default implementation simply copies over all iterable properties from the base object. Overwrite this method for properties that require special treatment

Parameters

Name Type
raw any

Returns

void

Inherited from

Storable._fromRaw

Defined in

core/src/encoding.ts:286


_toRaw

Protected _toRaw(version): any

Transform this object into a raw javascript object used for serialization. The default implementation simply copies all iterable properties not included in the [[exlude]] array and calls toRaw on any properties that are themselfes instances of Serializable. This method should be overwritten by subclasses if certain properties require special treatment.

Parameters

Name Type
version undefined | string

Returns

any

Inherited from

Storable._toRaw

Defined in

core/src/encoding.ts:257


clone

clone(): AppState

Creates a deep clone of the object

Returns

AppState

Inherited from

Storable.clone

Defined in

core/src/encoding.ts:244


fromBytes

fromBytes(bytes): AppState

Deserializes the object from a byte array

Parameters

Name Type
bytes Uint8Array

Returns

AppState

Inherited from

Storable.fromBytes

Defined in

core/src/encoding.ts:237


fromJSON

fromJSON(json): AppState

Deserializes the object from a JSON string

Parameters

Name Type
json string

Returns

AppState

Inherited from

Storable.fromJSON

Defined in

core/src/encoding.ts:223


fromRaw

fromRaw(raw): AppState

Restores propertiers from a raw object of the same form generated by toRaw. The base implementation blindly copies over values from the raw object via Object.assign so subclasses should explictly process any propertyies that need special treatment.

Also takes are of validation and "upgrading" in case the raw object has an old version. Use the protected _fromRaw method to implement subclass-specific behavior.

Parameters

Name Type
raw any

Returns

AppState

Inherited from

Storable.fromRaw

Defined in

core/src/encoding.ts:196


toBytes

toBytes(): Uint8Array

Returns a serialization of the object in form of a byte array

Returns

Uint8Array

Inherited from

Storable.toBytes

Defined in

core/src/encoding.ts:230


toJSON

toJSON(): string

Returns a JSON serialization of the object

Returns

string

Inherited from

Storable.toJSON

Defined in

core/src/encoding.ts:216


toRaw

toRaw(version?): any

Creates a raw javascript object representation of the class, which can be used for storage or data transmission. Also handles "downgrading" to previous versions. Use _toRaw for subclass-specific behavior.

Parameters

Name Type
version? string

Returns

any

Inherited from

Storable.toRaw

Defined in

core/src/encoding.ts:179


validate

validate(): boolean

This is called during deserialization and should verify that all properties have been populated with values of the correct type. Subclasses should implement this method based on their class structure.

Returns

boolean

Inherited from

Storable.validate

Defined in

core/src/encoding.ts:170