Move YG_ENABLE_EVENTS
checks to event.h
Summary: Instead of checking whether `YG_ENABLE_EVENTS` is defined for every publish, we simply wrap the body of the `publish` function macro that delegates to the method that actually publishes the event. This way we get 1. easier to write code where we publish events 2. more type safety when editing, enabling editors/IDEs to show errors without knowing about `YG_ENABLE_EVENTS` Reviewed By: SidharthGuglani Differential Revision: D16049888 fbshipit-source-id: cbf362d6f7be5053c3f377125d303b7137d6a241
This commit is contained in:
committed by
Facebook Github Bot
parent
c6ae314202
commit
cd5324378d
@@ -60,7 +60,9 @@ struct Event {
|
||||
|
||||
template <Type E>
|
||||
static void publish(const YGNode& node, const TypedData<E>& eventData = {}) {
|
||||
#ifdef YG_ENABLE_EVENTS
|
||||
publish(node, E, Data{eventData});
|
||||
#endif
|
||||
}
|
||||
|
||||
template <Type E>
|
||||
|
Reference in New Issue
Block a user