---
name: "JavaScript::Runtime"
section: "3pm"
platform: "linux"
package: "libjavascript-perl"
version: "1.16-3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/JavaScript::Runtime"
---

# JavaScript::Runtime(3pm)

Runs contexts

## NAME

JavaScript::Runtime - Runs contexts

## DESCRIPTION

## INTERFACE

### CLASS METHODS

- new ( $maxbytes )

  Creates a new runtime object. The optional argument *$maxbytes* specifies the number of bytes that can be allocated before garbage collection is runned. If ommited it defaults to 1MB.

### INSTANCE METHODS

- create\_context ()

  Creates a new `"JavaScript::Context"`-object in the runtime.

- set\_interrupt\_handler ( $handler )

  Attaches an interrupt handler (a function that is called before each op is executed ) to the runtime. The argument *$handler* must be either a code-reference or the name of a subroutine in the calling package.

  To remove the handler call this method with an undef as argument.

  Note that attaching an interrupt handler to the runtime causes a slowdown in execution speed since we must execute some Perl code between each op.

  In order to abort execution your handler should a false value (such as 0). All true values will continue execution. Any exceptions thrown by the handler are ignored and $@ is cleared.

## SEE ALSO

JavaScript::Context
