- Added an `Engine` which manages all promises and their tasks
This commit is contained in:
Tristan B. Velloza Kildaire 2023-03-03 17:30:51 +02:00
parent 9271fabfa9
commit 7d17b82c03
1 changed files with 30 additions and 0 deletions

30
source/eventy/engine.d Normal file
View File

@ -0,0 +1,30 @@
module eventy.engine;
import eventy.promise : Promise;
import eventy.task : Task;
/**
* Engine
*
* The core of the event sub-system, this maintains
* promises, allows introspection and control over them
* and also allows creating them
*
* NOTE: Do we even need this? Promises can track (themselves)
* who is waiting for them
*/
public class Engine
{
public Promise create(Task task)
{
// Create a promise associated with this engine instance
Promise newPromise = new Promise(this, task);
return newPromise;
}
}