mirror of
https://github.com/status-im/react-native.git
synced 2025-01-26 01:10:34 +00:00
504c7694c4
Summary: @public RawEvent represents ready-to-dispatch event data, an event that can be processed uniformly. Reviewed By: mdvacca Differential Revision: D8886235 fbshipit-source-id: 1c905517814330c5ecbf39f0ebc95ff2b576d1f2
49 lines
1021 B
C++
49 lines
1021 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
|
|
|
|
#include <memory>
|
|
|
|
#include <folly/dynamic.h>
|
|
#include <fabric/events/primitives.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
/*
|
|
* Represents ready-to-dispatch event data.
|
|
*/
|
|
class RawEvent {
|
|
|
|
public:
|
|
using RawEventDispatchable = std::function<bool()>;
|
|
|
|
RawEvent(
|
|
const std::string &type,
|
|
const folly::dynamic &payload,
|
|
const EventTarget &eventTarget,
|
|
const RawEventDispatchable &isDispachable
|
|
);
|
|
|
|
const std::string type;
|
|
const folly::dynamic payload;
|
|
const EventTarget eventTarget;
|
|
|
|
/*
|
|
* Returns `true` if event can be dispatched to `eventTarget`.
|
|
* Events that associated with unmounted or deallocated `ShadowNode`s
|
|
* must not be dispatched.
|
|
*/
|
|
bool isDispachable() const;
|
|
|
|
private:
|
|
const RawEventDispatchable isDispachable_;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|