mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
dc5cae5a6f
Summary: changelog: [internal] I will be enabling more clang tidy rules in Fabric to make it easier for new contributors and standardise the codebase. \ You can read more about the rule in https://clang.llvm.org/extra/clang-tidy/checks/modernize-avoid-bind.html Reviewed By: ShikaSD Differential Revision: D33162192 fbshipit-source-id: b4bb332f3134c42c49559a8baf10aeb7a7fdd87f
41 lines
803 B
C++
41 lines
803 B
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include "EventBeat.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
EventBeat::EventBeat(SharedOwnerBox const &ownerBox) : ownerBox_(ownerBox) {}
|
|
|
|
void EventBeat::request() const {
|
|
isRequested_ = true;
|
|
}
|
|
|
|
void EventBeat::beat(jsi::Runtime &runtime) const {
|
|
if (!this->isRequested_) {
|
|
return;
|
|
}
|
|
|
|
isRequested_ = false;
|
|
|
|
if (beatCallback_) {
|
|
beatCallback_(runtime);
|
|
}
|
|
}
|
|
|
|
void EventBeat::induce() const {
|
|
// Default implementation does nothing.
|
|
}
|
|
|
|
void EventBeat::setBeatCallback(BeatCallback beatCallback) {
|
|
beatCallback_ = std::move(beatCallback);
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|