NativeArray

The JavaScript Array.

Small arrays keep their elements in a plain Kotlin array (dense) and only fall back to the slot map once something makes that impossible: a huge index, a getter, a non-array prototype. Upstream also makes every array a java.util.List; that view is not ported.

Constructors

Link copied to clipboard
constructor(lengthArg: Long)
constructor(array: Array<Any?>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val allIds: Array<Any?>

Every property, enumerable or not.

Link copied to clipboard
open override val className: String

The class name, as Object.prototype.toString reports it.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var parentScope: Scriptable?
Link copied to clipboard
open override var prototype: Scriptable?
Link copied to clipboard
open val typeOf: String

What typeof says about this object.

Functions

Link copied to clipboard
fun associateValue(key: Any, value: Any): Any

Parks value under key, or returns what is already there.

Link copied to clipboard

True for an object that has to pretend it is undefined, which only NativeWith does.

Link copied to clipboard
fun defineBuiltinProperty(scope: Scriptable, name: String, length: Int, target: SerializableCallable, attributes: Int = DONTENUM, propertyAttributes: Int = DONTENUM or READONLY)

Same as above for a built-in method, which does not get a prototype property.

Link copied to clipboard
open override fun defineConst(name: String, start: Scriptable)
Link copied to clipboard
Link copied to clipboard
fun defineProperty(key: Symbol, value: Any?, attributes: Int)
fun defineProperty(propertyName: String, value: Any?, attributes: Int)

fun defineProperty(name: String, getter: () -> Any??, setter: (Any?) -> Unit?, attributes: Int)

Defines a property whose value comes from a lambda that needs nothing but itself.

fun defineProperty(scope: Scriptable, name: String, length: Int, target: SerializableCallable, attributes: Int = DONTENUM, propertyAttributes: Int = DONTENUM or READONLY)

Defines a method backed by a Kotlin lambda.

Link copied to clipboard
open override fun delete(index: Int)
open override fun delete(key: Symbol)
open override fun delete(name: String)
Link copied to clipboard
Link copied to clipboard
fun get(index: Long): Any?
operator fun get(key: Any?): Any?
open override fun get(key: Symbol, start: Scriptable): Any?

open override fun get(index: Int, start: Scriptable): Any?

Gets an indexed property, or NOT_FOUND when there is none.

open override fun get(name: String, start: Scriptable): Any?

Gets a named property, or NOT_FOUND when there is none.

Link copied to clipboard

A value another part of the engine parked on this object under key.

Link copied to clipboard
open override fun getAttributes(index: Int): Int
open fun getAttributes(sym: Symbol): Int
open fun getAttributes(name: String): Int
Link copied to clipboard
open override fun getDefaultValue(hint: KClass<*>?): Any?

Converts this object to a primitive, guided by hint.

Link copied to clipboard
fun getGetterOrSetter(name: String?, index: Int, scope: Scriptable, isSetter: Boolean): Any?
Link copied to clipboard
open override fun getIds(): Array<Any?>

Every property name of this object alone, ignoring the prototype chain.

Link copied to clipboard
open override fun has(index: Int, start: Scriptable): Boolean
open override fun has(key: Symbol, start: Scriptable): Boolean
open override fun has(name: String, start: Scriptable): Boolean
Link copied to clipboard
open override fun hasInstance(instance: Scriptable): Boolean

Backs the instanceof operator.

Link copied to clipboard
open override fun isConst(name: String): Boolean
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
Link copied to clipboard
open override fun put(index: Int, start: Scriptable, value: Any?)
open override fun put(name: String, start: Scriptable, value: Any?)
open override fun put(key: Symbol, start: Scriptable, value: Any?)
Link copied to clipboard
open override fun putConst(name: String, start: Scriptable, value: Any?)
Link copied to clipboard

Seals the object, so no property can be added, removed or changed.

Link copied to clipboard
fun setAttributes(key: Symbol, attributes: Int)
fun setAttributes(index: Int, attributes: Int)
open fun setAttributes(name: String, attributes: Int)
Link copied to clipboard

Attaches data that lives outside the engine, or detaches it with null.

Link copied to clipboard
fun setGetterOrSetter(name: Any?, index: Int, getterOrSetter: Callable?, isSetter: Boolean)
Link copied to clipboard
open override fun size(): Int

Part of what java.util.Map needs. NativeObject finishes the job.

Link copied to clipboard
fun toArray(): Array<Any?>

The elements as Kotlin sees them: holes and undefined become null.