Skip to content

Commit 2546381

Browse files
committed
Third version of README.md
1 parent c72d1d9 commit 2546381

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,35 @@ Go version 1.18 is required to use this library due to the usage of generics.
2323

2424
To create new Join Patterns and Signals a Junction needs to be created first.
2525

26-
``
26+
```
2727
j := junction.NewJunction()
28-
``
28+
```
2929

3030
Afterwards, `AsyncSignals` and `SyncSignals` can be created through this junction. These functions return two values, a port and a signal.
3131
The port is used to register the signals with Join Patterns and signal is the function that can be called to send and receive values from the Join Pattern's action.
3232

33-
``
33+
```
3434
port, signal := junction.NewAsyncSignal[<TYPE>](j)
35-
``
35+
```
3636

3737
where `<TYPE>` is the data type of the value sent via the signal.
3838

3939

4040
or
4141

42-
``
42+
```
4343
port, signal := junction.NewSyncSignal[<SEND_TYPE>,<RECV_TYPE>](j)
44-
``
44+
```
4545

4646
where `<SEND_TYPE>` is the data type of the Signal to the Join Pattern and `<RECV_TYPE>` is the data type that will be returned to the signal.
4747

4848
Once Signals are created, they can be used to create new Join Patterns. Join Patterns can listen on up to 3 signals and are not limited to only one synchronous port.
4949

50-
``
50+
```
5151
junction.NewBinaryAsyncJoinPattern[<FIRST_TYPE>,<SECOND_TYPE>](portA, portB).Action(func(a <FIRST_TYPE>, b <SECOND_TYPE>) {
5252
// Add function code here
5353
})
54-
``
54+
```
5555

5656
In this example a binary async Join Pattern is created. This means that there exists now a function that will be executed in it's own goroutine once a message was received on both `portA` and `portB`.
5757
Once messages are received on both ports, the function is executed and receives both messages as the function parameters.

0 commit comments

Comments
 (0)