Skip to content

Commit

Permalink
docs(cardinal): add docs for events. (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrofolium authored Nov 4, 2023
1 parent 117e32a commit 171a885
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/pages/Cardinal/API-Reference/Events.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Events

Reference documentation for Events.

```go
package systems

import "pkg.world.dev/world-engine/cardinal"

func exampleSystem(ctx cardinal.WorldContext) {
ctx.EmitEvent("This is an example event string")
}
```

## Emit Events

The `EmitEvent` method on `cardinal.WorldContext` will emit event to all clients under the subject "event".

To see how to receive notifications go here: https://heroiclabs.com/docs/nakama/concepts/notifications/#receive-notifications (Unity)

```go
func (wCtx *worldContext) EmitEvent(event string)
```

### Parameters

| Parameter | Type | Description |
|-------------|-----------------------------------------------|----------------------------------------------------------------------------------------------------|
| event | string | The string to emit as an event |

3 changes: 3 additions & 0 deletions docs/pages/Cardinal/API-Reference/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
},
"cql": {
"title": "Cardinal Query Language (CQL)"
},
"Events": {
"title": "Events"
}
}

0 comments on commit 171a885

Please sign in to comment.