phasync
Frame / isCancellationRequested

Method

Frame::isCancellationRequested

Whether the frame, or a frame it is nested in, was asked to stop.

Description#

public Frame::isCancellationRequested(): bool

True after Frame::requestCancellation, Frame::cancel or a passed Frame::setTimeout deadline on this frame or one it is nested in; false otherwise. A property read: cheap enough to check on every pass of a hot loop.

Return values#

bool

Examples#

Example 1
while (!phasync::frame()->isCancellationRequested()) {
    $world->step();
    phasync::sleep(1 / 60);
}

See also#