Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a better communication config for event emitters #2498

Open
barak007 opened this issue Jun 19, 2024 · 0 comments
Open

Create a better communication config for event emitters #2498

barak007 opened this issue Jun 19, 2024 · 0 comments

Comments

@barak007
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant