Padloc Logo Docs & Resources

Class: DeviceInfo

platform.DeviceInfo

Object representing all information available for a given device.

Hierarchy

Constructors

constructor

new DeviceInfo(props?)

Parameters

Name Type
props? Partial<DeviceInfo>

Overrides

Serializable.constructor

Defined in

core/src/platform.ts:50

Properties

_propertySerializationOptions

_propertySerializationOptions: SerializationOptions[]

Inherited from

Serializable._propertySerializationOptions

Defined in

core/src/encoding.ts:163


appVersion

appVersion: string = ""

Padloc version installed on the device

Defined in

core/src/platform.ts:26


browser

browser: string = ""

The browser the application was loaded in, if applicable

Defined in

core/src/platform.ts:43


browserVersion

browserVersion: string = ""

The version of the browser the application was loaded in, if applicable

Defined in

core/src/platform.ts:46


description

description: string

Defined in

core/src/platform.ts:48


id

id: string = ""

Unique device identifier

Defined in

core/src/platform.ts:23


locale

locale: string = "en"

The devices locale setting

Defined in

core/src/platform.ts:34


manufacturer

manufacturer: string = ""

The device manufacturer, if available

Defined in

core/src/platform.ts:37


model

model: string = ""

The device mode, if available

Defined in

core/src/platform.ts:40


osVersion

osVersion: string = ""

OS version running on the device

Defined in

core/src/platform.ts:20


platform

platform: string = ""

Platform/Operating System running on the device

Defined in

core/src/platform.ts:17


userAgent

userAgent: string = ""

The user agent of the browser running the application

Defined in

core/src/platform.ts:31


vendorVersion

vendorVersion: string = ""

Defined in

core/src/platform.ts:28

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

Serializable.kind

Defined in

core/src/encoding.ts:159

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

Serializable._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

Serializable._toRaw

Defined in

core/src/encoding.ts:257


clone

clone(): DeviceInfo

Creates a deep clone of the object

Returns

DeviceInfo

Inherited from

Serializable.clone

Defined in

core/src/encoding.ts:244


fromBytes

fromBytes(bytes): DeviceInfo

Deserializes the object from a byte array

Parameters

Name Type
bytes Uint8Array

Returns

DeviceInfo

Inherited from

Serializable.fromBytes

Defined in

core/src/encoding.ts:237


fromJSON

fromJSON(json): DeviceInfo

Deserializes the object from a JSON string

Parameters

Name Type
json string

Returns

DeviceInfo

Inherited from

Serializable.fromJSON

Defined in

core/src/encoding.ts:223


fromRaw

fromRaw(raw): DeviceInfo

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

DeviceInfo

Inherited from

Serializable.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

Serializable.toBytes

Defined in

core/src/encoding.ts:230


toJSON

toJSON(): string

Returns a JSON serialization of the object

Returns

string

Inherited from

Serializable.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

Serializable.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

Serializable.validate

Defined in

core/src/encoding.ts:170