3.0.0 Beta 1
Pre-release
Pre-release
Note: This is a pre-release, there might be breaking changes in the final stable version.
Event Loop
Amp no longer ships its own event loop. It's now based on Revolt. Revolt\EventLoop is quite similar to Amp's previous Amp\Loop. A very important difference is using float $seconds instead of int $milliseconds for timers.
Futures
Future is a replacement for the previous Promise. It's await() method is based on fibers and replaces generator based coroutines / Amp\Promise\wait().
await()accepts an optionalCancellation, which can be used as a replacement forAmp\Promise\timeout().- Unhandled errors are now automatically thrown into the event loop, so there's no need for
Amp\Promise\rethrow()anymore. - Unhandled errors can be ignored using
Future::ignore().
Cancellation
CancellationTokenhas been renamed toCancellationCancellationTokenSourcehas been renamed toDeferredCancellationNullCancellationTokenhas been renamed toNullCancellationTimeoutCancellationTokenhas been renamed toTimeoutCancellationCombinedCancellationTokenhas been renamed toCompositeCancellation