The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

JS::Runtime - Runs contexts

SYNOPSIS

use JS;

my $rt = JS::Runtime->new();
my $ctx = $rt->create_context();

# BTW, if you don't need the runtime, it is always easier to just:

use JS;

my $ctx = JS::stock_context();

DESCRIPTION

In SpiderMonkey, a runtime is the data structure that holds javascript variables, objects, script and contexts. Every application needs to have a runtime. This class encapsulates the SpiderMonkey runtime object.

The main use of a runtime in JS is to create contexts, i.e. JS::Context instances.

INTERFACE

CLASS METHODS

new ( [ $maxbytes] )

Creates a new JS::Runtime object and returns it.

If the $maxbytes option is given, it's taken to be the number of bytes that can be allocated before garbage collection is run. If ommited defaults to 4MB.

INSTANCE METHODS

create_context ()

Creates a new JS::Context object in the runtime.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 88:

=over without closing =back