Valentin Shergin b3b72bbdcf Fabric: Using types EventTarget, EventHandler & co. instead of void * everywhere
Summary:
Nothing actually changed besides type names... which actually helps me found an issue in FabricUIManager!
Now there is no a single `void *` in Fabric/C++ and JavaScript bindings. Yay!

Reviewed By: fkgozali

Differential Revision: D8191420

fbshipit-source-id: b1eb60b6bc34dd25ab200aab854ffbd7ccf5b15d
2018-05-29 15:03:57 -07:00

37 lines
1007 B
C++

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
namespace facebook {
namespace react {
enum class EventPriority {
SynchronousUnbatched,
SynchronousBatched,
AsynchronousUnbatched,
AsynchronousBatched,
Sync = SynchronousUnbatched,
Work = SynchronousBatched,
Interactive = AsynchronousUnbatched,
Deferred = AsynchronousBatched,
};
/* `InstanceHandler`, `EventTarget`, and `EventHandler` are all opaque
* raw pointers. We use `struct {} *` trick to differentiate them in compiler's
* eyes to ensure type safety.
* These structs must have names (and the names must be exported)
* to allow consistent template (e.g. `std::function`) instantiating
* across different modules.
*/
using EventTarget = struct EventTargetDummyStruct {} *;
using EventHandler = struct EventHandlerDummyStruct {} *;
} // namespace react
} // namespace facebook