# ActionJavaScript

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / ActionJavaScript

# Class: ActionJavaScript

Represents an action that causes a script to be compiled and executed by the JavaScript interpreter.

## Extends

- [`ActionBase`](ActionBase)

## Constructors

### Constructor

> **new ActionJavaScript**(`om`, `javaScript?`): `ActionJavaScript`

Creates a new ActionJavaScript.

#### Parameters

##### om

[`ObjectManager`](ObjectManager)

[ObjectManager](ObjectManager) that controls the lifetime of the ActionJavaScript.

##### javaScript?

`string`

The JavaScript to execute.

#### Returns

`ActionJavaScript`

#### Overrides

`ActionBase.constructor`

### Constructor

> **new ActionJavaScript**(`javaScript?`): `ActionJavaScript`

Creates a new ActionJavaScript.

#### Parameters

##### javaScript?

`string`

The JavaScript to execute.

#### Returns

`ActionJavaScript`

#### Overrides

`ActionBase.constructor`

## Accessors

### id

#### Get Signature

> **get** **id**(): `number`

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`ActionBase`](ActionBase).[`id`](ActionBase#id)

***

### javaScript

#### Get Signature

> **get** **javaScript**(): `string`

Gets or sets the JavaScript to execute.

##### Returns

`string`

#### Set Signature

> **set** **javaScript**(`value`): `void`

Gets or sets the JavaScript to execute.

##### Parameters

###### value

`string`

##### Returns

`void`

***

### om

#### Get Signature

> **get** **om**(): [`ObjectManager`](ObjectManager)

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`ActionBase`](ActionBase).[`om`](ActionBase#om)

## Methods

### free()

> **free**(): `void`

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`ActionBase`](ActionBase).[`free`](ActionBase#free)

***

### rebind()

> **rebind**(`omTo`): `void`

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`ActionBase`](ActionBase).[`rebind`](ActionBase#rebind)
