mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 07:08:27 +00:00
Summary: We double down on JSI in Fabric. So, practically, JSI is now a hard dependency for Fabric. I hope it's for good. Now `jsi::Runtime` is coupled with scheduling via `EventExecuter`, so we have to make `jsi::Runtime` a part of `EventBeat` to proxy runtime reference to bindgings. Reviewed By: sahrens Differential Revision: D12837225 fbshipit-source-id: 98edc33d6a3358e6c2905f2f03ce0004a9ca0503
43 lines
824 B
C++
43 lines
824 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 {
|
|
|
|
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(const BeatCallback &beatCallback) {
|
|
beatCallback_ = beatCallback;
|
|
}
|
|
|
|
void EventBeat::setFailCallback(const FailCallback &failCallback) {
|
|
failCallback_ = failCallback;
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|