MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / Event

Class Event

Dependencies/AndroidExtensions/Source/Globals.cpp:26–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25 template<typename ... Args>
26 class Event final
27 {
28 public:
29 using Handler = std::function<void(Args ...)>;
30 using Ticket = typename arcana::ticketed_collection<Handler>::ticket;
31 Ticket AddHandler(Handler&& handler)
32 {
33 std::lock_guard<std::recursive_mutex> guard{m_mutex};
34 return m_handlers.insert(handler, m_mutex);
35 }
36
37 void Fire(Args ... args)
38 {
39 std::lock_guard<std::recursive_mutex> guard{m_mutex};
40 for (auto& handler : m_handlers)
41 {
42 handler(args ...);
43 }
44 }
45
46 private:
47 std::recursive_mutex m_mutex{};
48 arcana::ticketed_collection<Handler, std::recursive_mutex> m_handlers{};
49 };
50
51 using AppStateChangedEvent = Event<>;
52 AppStateChangedEvent g_pauseEvent{};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected