Platforms to show: All Mac Windows Linux Cross-Platform

Back to JSValueMBS class.

JSValueMBS.booleanValue as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Converts a JavaScript value to boolean and returns the resulting boolean.
Example
dim c as new JSContextMBS
dim j as JSValueMBS = c.valueWithBool(true)
MsgBox str(j.booleanValue)

(Read only property)

JSValueMBS.context as JSContextMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The context for this value.

(Read only property)

JSValueMBS.doubleValue as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Converts a JavaScript value to number and returns the resulting number.
Example
dim c as new JSContextMBS
dim j as JSValueMBS = c.valueWithDouble(5.3)
MsgBox str(j.doubleValue)

Returns the numeric result of conversion, or NaN if an exception is thrown.
(Read only property)

See also:

JSValueMBS.Handle as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The internal object reference.

(Read and Write property)

JSValueMBS.isArray as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a JavaScript value is an array.
Example
dim c as new JSContextMBS

dim e as JSValueMBS
dim v as JSValueMBS = c.NewArray(nil, e)

MsgBox str(v.isArray)

Returns true if value is an array, otherwise false.
Requires OS X 10.11 or newer.
(Read only property)

JSValueMBS.isBoolean as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a JavaScript value's type is the boolean type.
Example
dim c as new JSContextMBS
dim j as JSValueMBS = c.valueWithBool(true)
MsgBox str(j.isBoolean)

Returns true if value's type is the boolean type, otherwise false.
(Read only property)

JSValueMBS.isDate as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a JavaScript value is a date.
Example
dim c as new JSContextMBS

dim year as JSValueMBS = c.valueWithDouble(2015)
dim month as JSValueMBS = c.valueWithDouble(5)
dim day as JSValueMBS = c.valueWithDouble(12)

dim e as JSValueMBS // exception
dim d as JSValueMBS = c.NewDate(array(year, month, day), e)

MsgBox str(d.isDate)

Returns true if value is a date, otherwise false.
Requires OS X 10.11 or newer.
(Read only property)

JSValueMBS.isNull as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a JavaScript value's type is the null type.
Example
dim c as new JSContextMBS
dim n as JSValueMBS = c.valueWithNull

MsgBox str(n.isNull)

Returns true if value's type is the null type, otherwise false.
(Read only property)

JSValueMBS.isNumber as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a JavaScript value's type is the number type.
Example
dim c as new JSContextMBS

dim j as JSValueMBS = c.valueWithDouble(5)
MsgBox str(j.isNumber)

Returns true if value's type is the number type, otherwise false.
(Read only property)

JSValueMBS.isObject as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a JavaScript value's type is the object type.
Example
dim c as new JSContextMBS

dim e as JSValueMBS
dim v as JSValueMBS = c.NewArray(nil, e)

MsgBox str(v.isObject)

Returns true if value's type is the object type, otherwise false.
(Read only property)

JSValueMBS.isString as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a JavaScript value's type is the string type.
Example
dim c as new JSContextMBS
dim s as JSValueMBS = c.valueWithJSON("""Hello""")
MsgBox str(s.isString)

Returns true if value's type is the string type, otherwise false.
(Read only property)

JSValueMBS.isUndefined as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a JavaScript value's type is the undefined type.
Example
dim c as new JSContextMBS

dim j as JSValueMBS = c.valueWithUndefined
MsgBox str(j.isUndefined)

Returns true if value's type is the undefined type, otherwise false.
(Read only property)

JSValueMBS.JSONString as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a JavaScript string containing the JSON serialized representation of a JS value.
Example
dim c as new JSContextMBS

dim v as JSValueMBS = c.valueWithString("Hello")
MsgBox v.JSONString

Requires Mac OS X 10.7 and newer.
(Read only property)

See also:

Some examples using this property:

JSValueMBS.StringValue as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Converts a JavaScript value to string and copies the result into a JavaScript string.
Example
dim c as new JSContextMBS

dim v as JSValueMBS = c.valueWithString("Hello")
MsgBox v.StringValue

Returns a JSString with the result of conversion, or NULL if an exception is thrown.
(Read only property)

See also:

JSValueMBS.Tag as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The tag value.

You can store anything here and as long as the JSValue object exists, this value is kept referenced.
(Read and Write property)

JSValueMBS.Type as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property JavaScript MBS MacFrameworks Plugin 15.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns a JavaScript value's type.
Example
dim c as new JSContextMBS
dim j as JSValueMBS

j = c.valueWithDouble(1) // double
'j = c.valueWithNull // null
'j = c.valueWithUndefined // undefined
'j = c.valueWithString("Hello") // string
'j = c.valueWithJSON("{""tag"": 1}") // object
'j = c.valueWithBool(true)

Select case j.Type
case JSValueMBS.kJSTypeUndefined
MsgBox "undefined"
case JSValueMBS.kJSTypeNull
MsgBox "null"
case JSValueMBS.kJSTypeBoolean
MsgBox "boolean "+str(j.booleanValue)
case JSValueMBS.kJSTypeNumber
MsgBox "number "+str(j.doubleValue)
case JSValueMBS.kJSTypeString
MsgBox "string "+j.StringValue
case JSValueMBS.kJSTypeObject
MsgBox "object "+j.JSONString
else
Break
end Select

(Read only property)

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...