JavaSc...romise(3pm)

πŸ“¦
version 0.21 Β· 5 versions
, in ubuntu stonking

πŸ’– JavaScript::QuickJS::Promise πŸ’–

okay bestie, so this is the User Contributed Perl Documentation page for the 3pm manual section, and it's all about JavaScript::QuickJS::Promise β€” no cap, it's giving "Perl meets JavaScript, and they're holding hands". 🫢


✨ NAME ✨

JavaScript::QuickJS::Promise β€” JavaScript Promise in Perl πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's the whole vibe in code, literally copy-paste-core:

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";

it's giving setup, resolve, await, slay. ⭐


πŸ¦‹ DESCRIPTION πŸ¦‹

This class is literally the Perl representation of a JavaScript Promise instance. Like, the actual thing. 🌸

here's the MDN link so you can go read up on Promise in JS-land, exactly as written:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

πŸ’€ important bestie: this class is not instantiated directly. don't come for me trying JavaScript::QuickJS::Promise->new, that's not the move. you get these from QuickJS itself. periodt.

πŸ‘‘ METHODS πŸ‘‘

not me exposing then(), catch(), and finally() β€” because yes, this class exposes all three of those, and each one wraps the JavaScript method with the exact same name. iykyk. ✨

  • then() β€” wraps the JavaScript then() 🫢
  • catch() β€” wraps the JavaScript catch() πŸ™ˆ
  • finally() β€” wraps the JavaScript finally(), yes the finale, the last act πŸ’œ

and that's the whole page, bestie!! this was perl v5.42.3, dated 2026-08-19, from the JavaSc...romise(3pm) manual. mwah, love u, go await something. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from