> For the complete documentation index, see [llms.txt](https://pika-soft.gitbook.io/rsc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pika-soft.gitbook.io/rsc/api/classes/event.md).

# Event

## RSC.Event.New()

```rust
Event RSC.Event.New()
```

Creates a new Event object

```lua
-- Example of using Event class
local event = RSC.Event.New()
event:On(print)
event:Emit(1, "2", {}) -- 1    2   table 0x12faf231ac
```

## :On(...)

```rust
Event:On( func: function(...), identifier?: any )
```

Registers a new function that can be called with [Event:Emit(...)](#event-emit) function.

## :Once(...)

```rust
Event:Once( func: function(...), identifier?: any )
```

Same as [Event:On](#event-on), but `func` will be called only once

## :Remove(...)

```rust
Event:Remove( identifier: any )
```

Removes registered function by specified identifier. If identifier wasn't specified, then you can pass a function that was registered.

## :Emit(...)

```rust
Event:Emit(...)
```

Calls registered functions with passed arguments.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pika-soft.gitbook.io/rsc/api/classes/event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
