Files
react-native/ReactCommon/react/renderer/core/EventBeat.cpp
T
Samuel Susla dc5cae5a6f Enable modernize-avoid-bind in clang tidy
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
2021-12-20 04:30:52 -08:00

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