2018-05-22 22:48:19 +00:00
|
|
|
/**
|
|
|
|
* 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>
|
|
|
|
|
2018-07-18 05:41:39 +00:00
|
|
|
#include <fabric/events/primitives.h>
|
2018-05-22 22:48:19 +00:00
|
|
|
#include <folly/dynamic.h>
|
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
|
|
|
|
|
|
|
class EventDispatcher;
|
|
|
|
|
|
|
|
using SharedEventDispatcher = std::shared_ptr<const EventDispatcher>;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Abstract class that represent event-delivery infrastructure.
|
2018-06-09 20:02:55 +00:00
|
|
|
* Particular `EventEmitter` clases use an object of this class to invoke
|
2018-05-22 22:48:19 +00:00
|
|
|
* events.
|
|
|
|
*/
|
|
|
|
class EventDispatcher {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dispatches "raw" event using some event-delivery infrastructure.
|
|
|
|
*/
|
|
|
|
virtual void dispatchEvent(
|
2018-06-01 16:36:25 +00:00
|
|
|
const EventTarget &eventTarget,
|
|
|
|
const std::string &type,
|
2018-05-22 22:48:19 +00:00
|
|
|
const folly::dynamic &payload,
|
|
|
|
const EventPriority &priority
|
|
|
|
) const = 0;
|
2018-06-21 21:14:59 +00:00
|
|
|
|
|
|
|
virtual void releaseEventTarget(const EventTarget &eventTarget) const = 0;
|
|
|
|
|
2018-05-22 22:48:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace react
|
|
|
|
} // namespace facebook
|