Skip to content

Commit c57b46f

Browse files
tsaichienfacebook-github-bot
authored andcommitted
Add IRuntime interface (#54923)
Summary: After reviewing the feasibility of adding new Runtime functionality, we realized the current state of `Runtime` makes it hard/inconvenient to add new basic functionality. It requires creating a new interface (e.g. `IRuntime2`) to declare the new APIs. Then, everywhere it is needed, both the original `Runtime` and `IRuntime2` needs to passed in to access both APIs. After discussion, we decided to introduce `IRuntime`, which will declare most of the `Runtime` functionalities. All "protected" APIs, which made sense before interfaces were introduced, will now be public. The protected static methods of `Runtime` will remain as is for the Friends to access. After we decided to cut "stable" (after incoming JSI improvements), new functionalities will be added in `IRuntime2` interface. `IRuntime2` will inherit `IRuntime` to make existing functionality easy to access. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D89093651
1 parent dfddcc9 commit c57b46f

File tree

4 files changed

+411
-313
lines changed

4 files changed

+411
-313
lines changed

packages/react-native/ReactCommon/jsc/JSCRuntime.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ class JSCRuntime : public jsi::Runtime {
146146
friend class JSCRuntime;
147147
};
148148

149+
using IRuntime::getProperty;
150+
using IRuntime::hasProperty;
151+
using IRuntime::setPropertyValue;
152+
149153
PointerValue* cloneSymbol(const Runtime::PointerValue* pv) override;
150154
PointerValue* cloneBigInt(const Runtime::PointerValue* pv) override;
151155
PointerValue* cloneString(const Runtime::PointerValue* pv) override;

0 commit comments

Comments
 (0)