1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 */ 7 8 #pragma once 9 10 namespace ABI49_0_0facebook::ABI49_0_0React { 11 12 using EventTag = unsigned int; 13 14 /* 15 * Interface for logging discrete events (such as pointerenter/leave), 16 * which can be used for implementing W3C Event Timing API standard, 17 * see https://www.w3.org/TR/event-timing 18 */ 19 class EventLogger { 20 public: 21 virtual ~EventLogger() = default; 22 23 /* 24 * Called when an event is first created, returns and unique tag for this 25 * event, which can be used to log further event processing stages. 26 */ 27 virtual EventTag onEventStart(const char *name) = 0; 28 29 /* 30 * Called when event starts getting dispatched (processed by the handlers, if 31 * any) 32 */ 33 virtual void onEventDispatch(EventTag tag) = 0; 34 35 /* 36 * Called when event finishes being dispatched 37 */ 38 virtual void onEventEnd(EventTag tag) = 0; 39 }; 40 41 void setEventLogger(EventLogger *eventLogger); 42 EventLogger *getEventLogger(); 43 44 } // namespace ABI49_0_0facebook::ABI49_0_0React 45