engine icon indicating copy to clipboard operation
engine copied to clipboard

Create a better communication config for event emitters

Open barak007 opened this issue 8 months ago • 0 comments

Example of usage in a service

class MyService{
    mySignal = new Signal()
}

Example of config in feature

export default class BoardCapabilities extends Feature<"F1"> {
  id = "F1" as const;
  dependencies = [];
  api = {
    myService: Service.withType<MyService>()
      .defineEntity(processingEnv)
      .allowRemoteAccess(asyncSignal("mySignal")),
  };
}

The idea is one function asyncSignal (in this example the name can be changed) should define all the on/off/sub/unsub.... on the emitter. this will save a lot of boilerplate code in all services and make the entire Signal an AsyncSignal

barak007 avatar Jun 19 '24 08:06 barak007