react-native-windows 0.80.0 → 0.80.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/Directory.Build.props +1 -1
  2. package/Microsoft.ReactNative/Fabric/Composition/DebuggerUIIsland.cpp +169 -0
  3. package/Microsoft.ReactNative/Fabric/Composition/DebuggerUIIsland.h +42 -0
  4. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -1
  5. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +60 -33
  6. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +68 -1
  7. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +9 -0
  8. package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +5 -37
  9. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +5 -3
  10. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +6 -1
  11. package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +14 -1
  12. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +0 -17
  13. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.h +0 -3
  14. package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.cpp +75 -24
  15. package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.h +4 -25
  16. package/Microsoft.ReactNative/JsiApi.cpp +1 -1
  17. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -0
  18. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +3 -0
  19. package/Microsoft.ReactNative/ReactHost/DebuggerNotifications.h +54 -0
  20. package/Microsoft.ReactNative/ReactHost/React.h +11 -4
  21. package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +195 -29
  22. package/Microsoft.ReactNative/ReactHost/ReactHost.h +22 -4
  23. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +24 -5
  24. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
  25. package/Microsoft.ReactNative/ReactRootView.cpp +108 -0
  26. package/Microsoft.ReactNative/ReactRootView.h +6 -0
  27. package/Microsoft.ReactNative/Views/DevMenu.cpp +1 -1
  28. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +1 -1
  29. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  30. package/PropertySheets/JSEngine.props +1 -1
  31. package/PropertySheets/React.Cpp.props +2 -2
  32. package/ReactCommon/ReactCommon.vcxproj +18 -1
  33. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +1 -1
  34. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +4 -4
  35. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +23 -9
  36. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +16 -0
  37. package/ReactCommon/cgmanifest.json +1 -1
  38. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +2 -0
  39. package/Shared/DevServerHelper.h +13 -3
  40. package/Shared/DevSettings.h +7 -0
  41. package/Shared/DevSupportManager.cpp +79 -20
  42. package/Shared/DevSupportManager.h +7 -19
  43. package/Shared/Hermes/HermesRuntimeAgentDelegate.cpp +99 -0
  44. package/Shared/Hermes/HermesRuntimeAgentDelegate.h +81 -0
  45. package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +263 -0
  46. package/Shared/Hermes/HermesRuntimeTargetDelegate.h +77 -0
  47. package/Shared/HermesRuntimeHolder.cpp +29 -111
  48. package/Shared/HermesRuntimeHolder.h +214 -32
  49. package/Shared/IDevSupportManager.h +5 -2
  50. package/Shared/Inspector/ReactInspectorPackagerConnectionDelegate.cpp +108 -0
  51. package/Shared/Inspector/ReactInspectorPackagerConnectionDelegate.h +19 -0
  52. package/Shared/Inspector/ReactInspectorThread.h +18 -0
  53. package/Shared/JSI/RuntimeHolder.h +5 -2
  54. package/Shared/OInstance.cpp +44 -27
  55. package/Shared/Shared.vcxitems +27 -17
  56. package/Shared/Shared.vcxitems.filters +33 -15
  57. package/package.json +4 -4
  58. package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +0 -79
  59. package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.h +0 -51
  60. package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +0 -50
  61. package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.cpp +0 -41
  62. package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.h +0 -127
  63. package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.inc +0 -125
  64. package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +0 -16
  65. package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_win.cpp +0 -23
  66. package/Microsoft.ReactNative.Cxx/JSI/decorator.h +0 -1054
  67. package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +0 -145
  68. package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +0 -372
  69. package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +0 -797
  70. package/Microsoft.ReactNative.Cxx/JSI/jsi.h +0 -1799
  71. package/Microsoft.ReactNative.Cxx/JSI/threadsafe.h +0 -79
  72. package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +0 -3531
  73. package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +0 -38
  74. package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +0 -614
  75. package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +0 -212
  76. package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +0 -199
  77. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +0 -78
  78. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +0 -196
  79. package/ReactCommon/TEMP_UntilReactCommonUpdate/jserrorhandler/JsErrorHandler.cpp +0 -429
  80. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsitooling/react/runtime/JSRuntimeFactory.cpp +0 -45
  81. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsitooling/react/runtime/JSRuntimeFactory.h +0 -91
  82. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +0 -670
  83. package/Shared/InspectorPackagerConnection.cpp +0 -232
  84. package/Shared/InspectorPackagerConnection.h +0 -61
  85. /package/Shared/{HermesSamplingProfiler.cpp → Hermes/HermesSamplingProfiler.cpp} +0 -0
  86. /package/Shared/{HermesSamplingProfiler.h → Hermes/HermesSamplingProfiler.h} +0 -0
@@ -1,145 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #pragma once
9
-
10
- #include <chrono>
11
- #include <iosfwd>
12
- #include <string>
13
- #include <tuple>
14
- #include <unordered_map>
15
-
16
- #include <jsi/jsi.h>
17
-
18
- namespace facebook {
19
- namespace jsi {
20
-
21
- /// Methods for starting and collecting instrumentation, an \c Instrumentation
22
- /// instance is associated with a particular \c Runtime instance, which it
23
- /// controls the instrumentation of.
24
- /// None of these functions should return newly created jsi values, nor should
25
- /// it modify the values of any jsi values in the heap (although GCs are fine).
26
- class JSI_EXPORT Instrumentation {
27
- public:
28
- #if JSI_VERSION >= 13
29
- /// Additional options controlling what to include when capturing a heap
30
- /// snapshot.
31
- struct HeapSnapshotOptions {
32
- bool captureNumericValue{false};
33
- };
34
- #endif
35
-
36
- virtual ~Instrumentation() = default;
37
-
38
- /// Returns GC statistics as a JSON-encoded string, with an object containing
39
- /// "type" and "version" fields outermost. "type" is a string, unique to a
40
- /// particular implementation of \c jsi::Instrumentation, and "version" is a
41
- /// number to indicate any revision to that implementation and its output
42
- /// format.
43
- ///
44
- /// \pre This call can only be made on the instrumentation instance of a
45
- /// runtime initialised to collect GC statistics.
46
- ///
47
- /// \post All cumulative measurements mentioned in the output are accumulated
48
- /// across the entire lifetime of the Runtime.
49
- ///
50
- /// \return the GC statistics collected so far, as a JSON-encoded string.
51
- virtual std::string getRecordedGCStats() = 0;
52
-
53
- /// Request statistics about the current state of the runtime's heap. This
54
- /// function can be called at any time, and should produce information that is
55
- /// correct at the instant it is called (i.e, not stale).
56
- ///
57
- /// \return a map from a string key to a number associated with that
58
- /// statistic.
59
- virtual std::unordered_map<std::string, int64_t> getHeapInfo(
60
- bool includeExpensive) = 0;
61
-
62
- /// Perform a full garbage collection.
63
- /// \param cause The cause of this collection, as it should be reported in
64
- /// logs.
65
- virtual void collectGarbage(std::string cause) = 0;
66
-
67
- /// A HeapStatsUpdate is a tuple of the fragment index, the number of objects
68
- /// in that fragment, and the number of bytes used by those objects.
69
- /// A "fragment" is a view of all objects allocated within a time slice.
70
- using HeapStatsUpdate = std::tuple<uint64_t, uint64_t, uint64_t>;
71
-
72
- /// Start capturing JS stack-traces for all JS heap allocated objects. These
73
- /// can be accessed via \c ::createSnapshotToFile().
74
- /// \param fragmentCallback If present, invoke this callback every so often
75
- /// with the most recently seen object ID, and a list of fragments that have
76
- /// been updated. This callback will be invoked on the same thread that the
77
- /// runtime is using.
78
- virtual void startTrackingHeapObjectStackTraces(
79
- std::function<void(
80
- uint64_t lastSeenObjectID,
81
- std::chrono::microseconds timestamp,
82
- std::vector<HeapStatsUpdate> stats)> fragmentCallback) = 0;
83
-
84
- /// Stop capture JS stack-traces for JS heap allocated objects.
85
- virtual void stopTrackingHeapObjectStackTraces() = 0;
86
-
87
- /// Start a heap sampling profiler that will sample heap allocations, and the
88
- /// stack trace they were allocated at. Reports a summary of which functions
89
- /// allocated the most.
90
- /// \param samplingInterval The number of bytes allocated to wait between
91
- /// samples. This will be used as the expected value of a poisson
92
- /// distribution.
93
- virtual void startHeapSampling(size_t samplingInterval) = 0;
94
-
95
- /// Turns off the heap sampling profiler previously enabled via
96
- /// \c startHeapSampling. Writes the output of the sampling heap profiler to
97
- /// \p os. The output is a JSON formatted string.
98
- virtual void stopHeapSampling(std::ostream& os) = 0;
99
-
100
- #if JSI_VERSION >= 13
101
- /// Captures the heap to a file
102
- ///
103
- /// \param path to save the heap capture.
104
- /// \param options additional options for what to capture.
105
- virtual void createSnapshotToFile(
106
- const std::string& path,
107
- const HeapSnapshotOptions& options = {false}) = 0;
108
- #else
109
- /// Captures the heap to a file
110
- ///
111
- /// \param path to save the heap capture
112
- virtual void createSnapshotToFile(const std::string& path) = 0;
113
- #endif
114
-
115
- #if JSI_VERSION >= 13
116
- /// Captures the heap to an output stream
117
- ///
118
- /// \param os output stream to write to.
119
- /// \param options additional options for what to capture.
120
- virtual void createSnapshotToStream(
121
- std::ostream& os,
122
- const HeapSnapshotOptions& options = {false}) = 0;
123
- #else
124
- /// Captures the heap to an output stream
125
- ///
126
- /// \param os output stream to write to.
127
- virtual void createSnapshotToStream(std::ostream& os) = 0;
128
- #endif
129
-
130
- /// If the runtime has been created to trace to a temp file, flush
131
- /// any unwritten parts of the trace of bridge traffic to the file,
132
- /// and return the name of the file. Otherwise, return the empty string.
133
- /// Tracing is disabled after this call.
134
- virtual std::string flushAndDisableBridgeTrafficTrace() = 0;
135
-
136
- /// Write basic block profile trace to the given file name.
137
- virtual void writeBasicBlockProfileTraceToFile(
138
- const std::string& fileName) const = 0;
139
-
140
- /// Dump external profiler symbols to the given file name.
141
- virtual void dumpProfilerSymbolsToFile(const std::string& fileName) const = 0;
142
- };
143
-
144
- } // namespace jsi
145
- } // namespace facebook
@@ -1,372 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #pragma once
9
-
10
- namespace facebook {
11
- namespace jsi {
12
- namespace detail {
13
-
14
- inline Value toValue(Runtime&, std::nullptr_t) {
15
- return Value::null();
16
- }
17
- inline Value toValue(Runtime&, bool b) {
18
- return Value(b);
19
- }
20
- inline Value toValue(Runtime&, double d) {
21
- return Value(d);
22
- }
23
- inline Value toValue(Runtime&, float f) {
24
- return Value(static_cast<double>(f));
25
- }
26
- inline Value toValue(Runtime&, int i) {
27
- return Value(i);
28
- }
29
- inline Value toValue(Runtime& runtime, const char* str) {
30
- return String::createFromAscii(runtime, str);
31
- }
32
- inline Value toValue(Runtime& runtime, const std::string& str) {
33
- return String::createFromUtf8(runtime, str);
34
- }
35
- template <typename T>
36
- inline Value toValue(Runtime& runtime, const T& other) {
37
- static_assert(
38
- std::is_base_of<Pointer, T>::value,
39
- "This type cannot be converted to Value");
40
- return Value(runtime, other);
41
- }
42
- inline Value toValue(Runtime& runtime, const Value& value) {
43
- return Value(runtime, value);
44
- }
45
- inline Value&& toValue(Runtime&, Value&& value) {
46
- return std::move(value);
47
- }
48
-
49
- inline PropNameID toPropNameID(Runtime& runtime, const char* name) {
50
- return PropNameID::forAscii(runtime, name);
51
- }
52
- inline PropNameID toPropNameID(Runtime& runtime, const std::string& name) {
53
- return PropNameID::forUtf8(runtime, name);
54
- }
55
- inline PropNameID&& toPropNameID(Runtime&, PropNameID&& name) {
56
- return std::move(name);
57
- }
58
-
59
- /// Helper to throw while still compiling with exceptions turned off.
60
- template <typename E, typename... Args>
61
- [[noreturn]] inline void throwOrDie(Args&&... args) {
62
- std::rethrow_exception(
63
- std::make_exception_ptr(E{std::forward<Args>(args)...}));
64
- }
65
-
66
- } // namespace detail
67
-
68
- template <typename T>
69
- inline T Runtime::make(Runtime::PointerValue* pv) {
70
- return T(pv);
71
- }
72
-
73
- #if JSI_VERSION >= 3
74
- inline Runtime::PointerValue* Runtime::getPointerValue(jsi::Pointer& pointer) {
75
- return pointer.ptr_;
76
- }
77
- #endif
78
-
79
- inline const Runtime::PointerValue* Runtime::getPointerValue(
80
- const jsi::Pointer& pointer) {
81
- return pointer.ptr_;
82
- }
83
-
84
- inline const Runtime::PointerValue* Runtime::getPointerValue(
85
- const jsi::Value& value) {
86
- return value.data_.pointer.ptr_;
87
- }
88
-
89
- #if JSI_VERSION >= 17
90
- Value Object::getPrototype(Runtime& runtime) const {
91
- return runtime.getPrototypeOf(*this);
92
- }
93
- #endif
94
-
95
- inline Value Object::getProperty(Runtime& runtime, const char* name) const {
96
- return getProperty(runtime, String::createFromAscii(runtime, name));
97
- }
98
-
99
- inline Value Object::getProperty(Runtime& runtime, const String& name) const {
100
- return runtime.getProperty(*this, name);
101
- }
102
-
103
- inline Value Object::getProperty(Runtime& runtime, const PropNameID& name)
104
- const {
105
- return runtime.getProperty(*this, name);
106
- }
107
-
108
- inline bool Object::hasProperty(Runtime& runtime, const char* name) const {
109
- return hasProperty(runtime, String::createFromAscii(runtime, name));
110
- }
111
-
112
- inline bool Object::hasProperty(Runtime& runtime, const String& name) const {
113
- return runtime.hasProperty(*this, name);
114
- }
115
-
116
- inline bool Object::hasProperty(Runtime& runtime, const PropNameID& name)
117
- const {
118
- return runtime.hasProperty(*this, name);
119
- }
120
-
121
- template <typename T>
122
- void Object::setProperty(Runtime& runtime, const char* name, T&& value)
123
- JSI_CONST_10 {
124
- setProperty(
125
- runtime, String::createFromAscii(runtime, name), std::forward<T>(value));
126
- }
127
-
128
- template <typename T>
129
- void Object::setProperty(Runtime& runtime, const String& name, T&& value)
130
- JSI_CONST_10 {
131
- setPropertyValue(
132
- runtime, name, detail::toValue(runtime, std::forward<T>(value)));
133
- }
134
-
135
- template <typename T>
136
- void Object::setProperty(Runtime& runtime, const PropNameID& name, T&& value)
137
- JSI_CONST_10 {
138
- setPropertyValue(
139
- runtime, name, detail::toValue(runtime, std::forward<T>(value)));
140
- }
141
-
142
- inline Array Object::getArray(Runtime& runtime) const& {
143
- assert(runtime.isArray(*this));
144
- (void)runtime; // when assert is disabled we need to mark this as used
145
- return Array(runtime.cloneObject(ptr_));
146
- }
147
-
148
- inline Array Object::getArray(Runtime& runtime) && {
149
- assert(runtime.isArray(*this));
150
- (void)runtime; // when assert is disabled we need to mark this as used
151
- Runtime::PointerValue* value = ptr_;
152
- ptr_ = nullptr;
153
- return Array(value);
154
- }
155
-
156
- inline ArrayBuffer Object::getArrayBuffer(Runtime& runtime) const& {
157
- assert(runtime.isArrayBuffer(*this));
158
- (void)runtime; // when assert is disabled we need to mark this as used
159
- return ArrayBuffer(runtime.cloneObject(ptr_));
160
- }
161
-
162
- inline ArrayBuffer Object::getArrayBuffer(Runtime& runtime) && {
163
- assert(runtime.isArrayBuffer(*this));
164
- (void)runtime; // when assert is disabled we need to mark this as used
165
- Runtime::PointerValue* value = ptr_;
166
- ptr_ = nullptr;
167
- return ArrayBuffer(value);
168
- }
169
-
170
- inline Function Object::getFunction(Runtime& runtime) const& {
171
- assert(runtime.isFunction(*this));
172
- return Function(runtime.cloneObject(ptr_));
173
- }
174
-
175
- inline Function Object::getFunction(Runtime& runtime) && {
176
- assert(runtime.isFunction(*this));
177
- (void)runtime; // when assert is disabled we need to mark this as used
178
- Runtime::PointerValue* value = ptr_;
179
- ptr_ = nullptr;
180
- return Function(value);
181
- }
182
-
183
- template <typename T>
184
- inline bool Object::isHostObject(Runtime& runtime) const {
185
- return runtime.isHostObject(*this) &&
186
- std::dynamic_pointer_cast<T>(runtime.getHostObject(*this));
187
- }
188
-
189
- template <>
190
- inline bool Object::isHostObject<HostObject>(Runtime& runtime) const {
191
- return runtime.isHostObject(*this);
192
- }
193
-
194
- template <typename T>
195
- inline std::shared_ptr<T> Object::getHostObject(Runtime& runtime) const {
196
- assert(isHostObject<T>(runtime));
197
- return std::static_pointer_cast<T>(runtime.getHostObject(*this));
198
- }
199
-
200
- template <typename T>
201
- inline std::shared_ptr<T> Object::asHostObject(Runtime& runtime) const {
202
- if (!isHostObject<T>(runtime)) {
203
- detail::throwOrDie<JSINativeException>(
204
- "Object is not a HostObject of desired type");
205
- }
206
- return std::static_pointer_cast<T>(runtime.getHostObject(*this));
207
- }
208
-
209
- template <>
210
- inline std::shared_ptr<HostObject> Object::getHostObject<HostObject>(
211
- Runtime& runtime) const {
212
- assert(runtime.isHostObject(*this));
213
- return runtime.getHostObject(*this);
214
- }
215
-
216
- #if JSI_VERSION >= 7
217
- template <typename T>
218
- inline bool Object::hasNativeState(Runtime& runtime) const {
219
- return runtime.hasNativeState(*this) &&
220
- std::dynamic_pointer_cast<T>(runtime.getNativeState(*this));
221
- }
222
-
223
- template <>
224
- inline bool Object::hasNativeState<NativeState>(Runtime& runtime) const {
225
- return runtime.hasNativeState(*this);
226
- }
227
-
228
- template <typename T>
229
- inline std::shared_ptr<T> Object::getNativeState(Runtime& runtime) const {
230
- assert(hasNativeState<T>(runtime));
231
- return std::static_pointer_cast<T>(runtime.getNativeState(*this));
232
- }
233
-
234
- inline void Object::setNativeState(
235
- Runtime& runtime,
236
- std::shared_ptr<NativeState> state) const {
237
- runtime.setNativeState(*this, state);
238
- }
239
- #endif
240
-
241
- #if JSI_VERSION >= 11
242
- inline void Object::setExternalMemoryPressure(Runtime& runtime, size_t amt)
243
- const {
244
- runtime.setExternalMemoryPressure(*this, amt);
245
- }
246
- #endif
247
-
248
- inline Array Object::getPropertyNames(Runtime& runtime) const {
249
- return runtime.getPropertyNames(*this);
250
- }
251
-
252
- inline Value WeakObject::lock(Runtime& runtime) JSI_CONST_10 {
253
- return runtime.lockWeakObject(*this);
254
- }
255
-
256
- template <typename T>
257
- void Array::setValueAtIndex(Runtime& runtime, size_t i, T&& value)
258
- JSI_CONST_10 {
259
- setValueAtIndexImpl(
260
- runtime, i, detail::toValue(runtime, std::forward<T>(value)));
261
- }
262
-
263
- inline Value Array::getValueAtIndex(Runtime& runtime, size_t i) const {
264
- return runtime.getValueAtIndex(*this, i);
265
- }
266
-
267
- inline Function Function::createFromHostFunction(
268
- Runtime& runtime,
269
- const jsi::PropNameID& name,
270
- unsigned int paramCount,
271
- jsi::HostFunctionType func) {
272
- return runtime.createFunctionFromHostFunction(
273
- name, paramCount, std::move(func));
274
- }
275
-
276
- inline Value Function::call(Runtime& runtime, const Value* args, size_t count)
277
- const {
278
- return runtime.call(*this, Value::undefined(), args, count);
279
- }
280
-
281
- inline Value Function::call(Runtime& runtime, std::initializer_list<Value> args)
282
- const {
283
- return call(runtime, args.begin(), args.size());
284
- }
285
-
286
- template <typename... Args>
287
- inline Value Function::call(Runtime& runtime, Args&&... args) const {
288
- // A more awesome version of this would be able to create raw values
289
- // which can be used directly without wrapping and unwrapping, but
290
- // this will do for now.
291
- return call(runtime, {detail::toValue(runtime, std::forward<Args>(args))...});
292
- }
293
-
294
- inline Value Function::callWithThis(
295
- Runtime& runtime,
296
- const Object& jsThis,
297
- const Value* args,
298
- size_t count) const {
299
- return runtime.call(*this, Value(runtime, jsThis), args, count);
300
- }
301
-
302
- inline Value Function::callWithThis(
303
- Runtime& runtime,
304
- const Object& jsThis,
305
- std::initializer_list<Value> args) const {
306
- return callWithThis(runtime, jsThis, args.begin(), args.size());
307
- }
308
-
309
- template <typename... Args>
310
- inline Value Function::callWithThis(
311
- Runtime& runtime,
312
- const Object& jsThis,
313
- Args&&... args) const {
314
- // A more awesome version of this would be able to create raw values
315
- // which can be used directly without wrapping and unwrapping, but
316
- // this will do for now.
317
- return callWithThis(
318
- runtime, jsThis, {detail::toValue(runtime, std::forward<Args>(args))...});
319
- }
320
-
321
- template <typename... Args>
322
- inline Array Array::createWithElements(Runtime& runtime, Args&&... args) {
323
- return createWithElements(
324
- runtime, {detail::toValue(runtime, std::forward<Args>(args))...});
325
- }
326
-
327
- template <typename... Args>
328
- inline std::vector<PropNameID> PropNameID::names(
329
- Runtime& runtime,
330
- Args&&... args) {
331
- return names({detail::toPropNameID(runtime, std::forward<Args>(args))...});
332
- }
333
-
334
- template <size_t N>
335
- inline std::vector<PropNameID> PropNameID::names(
336
- PropNameID (&&propertyNames)[N]) {
337
- std::vector<PropNameID> result;
338
- result.reserve(N);
339
- for (auto& name : propertyNames) {
340
- result.push_back(std::move(name));
341
- }
342
- return result;
343
- }
344
-
345
- inline Value Function::callAsConstructor(
346
- Runtime& runtime,
347
- const Value* args,
348
- size_t count) const {
349
- return runtime.callAsConstructor(*this, args, count);
350
- }
351
-
352
- inline Value Function::callAsConstructor(
353
- Runtime& runtime,
354
- std::initializer_list<Value> args) const {
355
- return callAsConstructor(runtime, args.begin(), args.size());
356
- }
357
-
358
- template <typename... Args>
359
- inline Value Function::callAsConstructor(Runtime& runtime, Args&&... args)
360
- const {
361
- return callAsConstructor(
362
- runtime, {detail::toValue(runtime, std::forward<Args>(args))...});
363
- }
364
-
365
- #if JSI_VERSION >= 8
366
- String BigInt::toString(Runtime& runtime, int radix) const {
367
- return runtime.bigintToString(*this, radix);
368
- }
369
- #endif
370
-
371
- } // namespace jsi
372
- } // namespace facebook