Skip to content

Commit

Permalink
Typed signatures for event handlers.
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Patrin <ppatrin@nvidia.com>
  • Loading branch information
pavelpatrin committed Aug 5, 2024
1 parent 81b2a01 commit 1d4dad0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,17 @@ to publish events to, and subscribe to events from, a centralized broker.
This mechanism allows services to remain decoupled while still being able to interact through a centralized medium.
In particular, the `gontainer.Events` service provides an interface to the events broker and can be injected as a dependency in any service factory.

#### Publishing Events
#### Triggering Events

To publish an event, use the Trigger method. Create an event using `NewEvent()` and pass the necessary arguments:
To trigger an event, use the `Trigger()` method. Create an event using `NewEvent()` and pass the necessary arguments:

```go
events.Trigger(gontainer.NewEvent("Event1", event, arguments, here))
```

#### Subscribing to Events

To subscribe to an event, use the `Subscribe` method. You can pass various types of handler functions, such as:
To subscribe to an event, use the `Subscribe()` method. You can pass various types of handler functions, such as:

- A handler that takes a variable number of any-typed arguments:
```go
Expand Down

0 comments on commit 1d4dad0

Please sign in to comment.