# Class JSObject

java.lang.Object
netscape.javascript.JSObject

@Deprecated(since="24", forRemoval=true) public abstract class JSObject extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
The jdk.jsobject module will be delivered with JavaFX.

Allows Java code to manipulate JavaScript objects.

When a JavaScript object is passed or returned to Java code, it is wrapped in an instance of `JSObject`. When a `JSObject` instance is passed to the JavaScript engine, it is unwrapped back to its original JavaScript object. The `JSObject` class provides a way to invoke JavaScript methods and examine JavaScript properties.

Any data returned from the JavaScript engine to Java is converted to Java data types. Certain data passed to the JavaScript engine is converted to JavaScript data types.

Since:
  1.5

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`JSObject()`
Deprecated, for removal: This API element is subject to removal in a future version.
Constructs a new JSObject.

## Method Summary

Modifier and Type
Method
Description
`abstract Object`
`call(String methodName, Object... args)`
Deprecated, for removal: This API element is subject to removal in a future version.
Calls a JavaScript method.
`abstract Object`
`eval(String s)`
Deprecated, for removal: This API element is subject to removal in a future version.
Evaluates a JavaScript expression.
`abstract Object`
`getMember(String name)`
Deprecated, for removal: This API element is subject to removal in a future version.
Retrieves a named member of a JavaScript object.
`abstract Object`
`getSlot(int index)`
Deprecated, for removal: This API element is subject to removal in a future version.
Retrieves an indexed member of a JavaScript object.
`abstract void`
`removeMember(String name)`
Deprecated, for removal: This API element is subject to removal in a future version.
Removes a named member of a JavaScript object.
`abstract void`
`setMember(String name, Object value)`
Deprecated, for removal: This API element is subject to removal in a future version.
Sets a named member of a JavaScript object.
`abstract void`
`setSlot(int index, Object value)`
Deprecated, for removal: This API element is subject to removal in a future version.
Sets an indexed member of a JavaScript object.

### Methods declared in class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### JSObject

protected JSObject()
Deprecated, for removal: This API element is subject to removal in a future version.
Constructs a new JSObject. Users should neither call this method nor subclass JSObject.

## Method Details

### call

public abstract Object call(String methodName, Object... args) throws JSException
Deprecated, for removal: This API element is subject to removal in a future version.
Calls a JavaScript method. Equivalent to "this.methodName(args[0], args[1], ...)" in JavaScript.

Parameters:
  `methodName` - The name of the JavaScript method to be invoked.
  `args` - the Java objects passed as arguments to the method.
Returns:
  Result of the method.
Throws:
  `JSException` - when an error is reported from the browser or JavaScript engine.

### eval

public abstract Object eval(String s) throws JSException
Deprecated, for removal: This API element is subject to removal in a future version.
Evaluates a JavaScript expression. The expression is a string of JavaScript source code which will be evaluated in the context given by "this".

Parameters:
  `s` - The JavaScript expression.
Returns:
  Result of the JavaScript evaluation.
Throws:
  `JSException` - when an error is reported from the browser or JavaScript engine.

### getMember

public abstract Object getMember(String name) throws JSException
Deprecated, for removal: This API element is subject to removal in a future version.
Retrieves a named member of a JavaScript object. Equivalent to "this.name" in JavaScript.

Parameters:
  `name` - The name of the JavaScript property to be accessed.
Returns:
  The value of the property.
Throws:
  `JSException` - when an error is reported from the browser or JavaScript engine.

### setMember

public abstract void setMember(String name, Object value) throws JSException
Deprecated, for removal: This API element is subject to removal in a future version.
Sets a named member of a JavaScript object. Equivalent to "this.name = value" in JavaScript.

Parameters:
  `name` - The name of the JavaScript property to be accessed.
  `value` - The value of the property.
Throws:
  `JSException` - when an error is reported from the browser or JavaScript engine.

### removeMember

public abstract void removeMember(String name) throws JSException
Deprecated, for removal: This API element is subject to removal in a future version.
Removes a named member of a JavaScript object. Equivalent to "delete this.name" in JavaScript.

Parameters:
  `name` - The name of the JavaScript property to be removed.
Throws:
  `JSException` - when an error is reported from the browser or JavaScript engine.

### getSlot

public abstract Object getSlot(int index) throws JSException
Deprecated, for removal: This API element is subject to removal in a future version.
Retrieves an indexed member of a JavaScript object. Equivalent to "this[index]" in JavaScript.

Parameters:
  `index` - The index of the array to be accessed.
Returns:
  The value of the indexed member.
Throws:
  `JSException` - when an error is reported from the browser or JavaScript engine.

### setSlot

public abstract void setSlot(int index, Object value) throws JSException
Deprecated, for removal: This API element is subject to removal in a future version.
Sets an indexed member of a JavaScript object. Equivalent to "this[index] = value" in JavaScript.

Parameters:
  `index` - The index of the array to be accessed.
  `value` - The value to set
Throws:
  `JSException` - when an error is reported from the browser or JavaScript engine.