Switchboard Extension SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
EventEmitter.hpp
1
//
2
// Created by Balazs Kiss on 2025. 02. 06..
3
//
4
5
#pragma once
6
7
#include <switchboard/export.h>
8
#include <any>
9
#include <memory>
10
#include <string>
11
12
#include <switchboard/Event.hpp>
13
14
namespace
switchboard {
15
19
class
SWITCHBOARDSDK_EXPORT
EventEmitter
{
20
public
:
21
22
using
Callback = std::function<void(
const
std::string&,
const
SBAny&)>;
23
27
EventEmitter
();
28
32
virtual
~EventEmitter
();
33
42
unsigned
int
addEventListener
(
const
std::string& eventName, Callback callback);
43
51
bool
removeEventListener
(
unsigned
int
listenerID);
52
53
protected
:
60
void
emitEvent
(
const
std::string& eventName,
const
SBAny& data);
61
62
private
:
63
class
Impl;
64
std::unique_ptr<Impl> pImpl;
65
};
66
67
}
switchboard::EventEmitter::removeEventListener
bool removeEventListener(unsigned int listenerID)
Removes an event listener from the object.
switchboard::EventEmitter::emitEvent
void emitEvent(const std::string &eventName, const SBAny &data)
Emits an event.
switchboard::EventEmitter::~EventEmitter
virtual ~EventEmitter()
Destructor for the EventEmitter class.
switchboard::EventEmitter::addEventListener
unsigned int addEventListener(const std::string &eventName, Callback callback)
Adds a new event listener to the object.
switchboard::EventEmitter::EventEmitter
EventEmitter()
Constructor for the EventEmitter class.
SwitchboardSDK
include
switchboard_core
EventEmitter.hpp
Generated by
1.17.0