File: Promise.pm

package info (click to toggle)
libjavascript-quickjs-perl 0.21-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,180 kB
  • sloc: ansic: 72,822; javascript: 7,743; perl: 1,065; makefile: 353; sh: 108
file content (39 lines) | stat: -rw-r--r-- 733 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package JavaScript::QuickJS::Promise;

use strict;
use warnings;

=encoding utf-8

=head1 NAME

JavaScript::QuickJS::Promise - JavaScript `Promise` in Perl

=head1 SYNOPSIS

    my $js = JavaScript::QuickJS->new();

    $js->eval("Promise.resolve(123)")->then( sub { CORE::say "resolved: @_" } );

    CORE::say "before await";

    $js->await();

    CORE::say "after await";

=head1 DESCRIPTION

This class represents a JavaScript
L<Promise|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise>
instance in Perl.

This class is not instantiated directly.

=head1 METHODS

This exposes C<then()>, C<catch()>, and C<finally()> methods that wrap the
JavaScript methods of the same names.

=cut

1;