Documentation for method in assembled from the following pages:
Class: Promise §
From Promise
(Promise) method in §
method in(Promise: , : = --> Promise)
Creates a new Promise that will be kept in $seconds seconds, or later.
my = Proc::Async.new('raku', '-e', 'sleep 10; warn "end"'); my = await Promise.anyof( my = .start, # may or may not work in time Promise.in(5).then: ).then: # OUTPUT: «timeout»
$seconds can be fractional or negative. Negative values are treated as 0 (i.e. keeping the returned Promise right away).
Please note that situations like these are often more clearly handled with a react and whenever block.