bedrockstreaming / tornado Goto Github PK
View Code? Open in Web Editor NEWA library for asynchronous programming :tornado: 🐎
License: MIT License
A library for asynchronous programming :tornado: 🐎
License: MIT License
To be able to use existing libraries returning "thenable" promises, we could add a method like
EventLoop::promiseFromThenable($thenablePromise): Promise
Up to each event loop implementation to deal with it.
It's very useful to launch an async function, and don't care about it's result/promise. But it can have a tricky side-effect, since exceptions will be stuck in the promise and never be propagated anywhere…
We could ensure that a "non yielded" promise will rethrow all exceptions when rejected.
See similar feature in Amp.
Notes 🤔 :
Currently, any exception thrown by an adapter is propagated to upper context outside of Tornado. It means that if you intend to catch a particular exception, it may be broken as soon as you change the used adapter.
Proposal:
@throws
annotation to document this behavior and improve developer experience with IDECurrently, the HttpClientTest mock network calls by passing a GuzzleMockAdapter
to the createHttpClient
function. But this function should stay generic, and don't assume that underlying client uses Guzzle.
A better approach could be to replace this parameter by an array of Psr\Http\Message\ResponseInterface
to return. Underlying concrete test will be in charge of instancing its own mock.
See React\LoopInterface.
Will improve interoperability possibilities.
May require some new features, like promise cancellation, or signal handling.
Tests are ready to run: ./bin/phpunit
Give possibility to cancel a promise, to stop the job necessary to resolve this promise.
See what's possible in other libraries:
Seems needed for #12
Add this new function in EventLoop
interface, implement it in each adapter, write tests
/**
* Returns a promise that will be resolved with `null` after at least $milliseconds.
**/
public function EventLoop::delay(int $milliseconds): Promise;
A good introduction page:
https://phpstan.org/r/0eaa8d12-2237-489a-9165-eb243d637329
As soon as release
There is a test suite to ensure that all examples run well.
https://github.com/M6Web/Tornado/blob/master/examples/tests/ExamplesTest.php
But they always run with the same adapter, hard coded in the example…
It should be possible to choose the adapter, in order to run tests with all existing adapters.
Input parameter 🤔 ? On the fly modification of the script 😨?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.