JavaScriptKit Documentation

Protocol Constructible​From​JSValue

public protocol ConstructibleFromJSValue  

Types conforming to this protocol can be constructed from JSValue.

%57 ConstructibleFromJSValue ConstructibleFromJSValue TypedArrayElement TypedArrayElement TypedArrayElement->ConstructibleFromJSValue JSString JSString JSString->ConstructibleFromJSValue

Types Conforming to Constructible​From​JSValue

TypedArrayElement

A protocol that allows a Swift numeric type to be mapped to the JavaScript TypedArray that holds integers of its type

JSString

JSString represents a string in JavaScript and supports bridging string between JavaScript and Swift.

Requirements

construct(from:​)

static func construct(from value: JSValue) -> Self? 

Construct an instance of Self, if possible, from the given JSValue. Return nil if the value is not compatible with the conforming Swift type.

Parameters

value JSValue

The JSValue to decode

Returns

An instance of Self, if one was successfully constructed from the value.