Skip to content

Commit c771917

Browse files
committed
Fix calls
1 parent fb9ded4 commit c771917

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

cpp/RNMultithreadingInstaller.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ void install(jsi::Runtime& runtime) {
99
ThreadPool pool(MAX_THREAD_COUNT);
1010
// TODO: Create runtimes for each thread pool? can I do on-demand instead?
1111

12-
// spawnThread(() => Promise<void>)
12+
// spawnThread(run: () => Promise<void>)
1313
auto spawnThread = jsi::Function::createFromHostFunction(runtime,
1414
jsi::PropNameID::forAscii(runtime, "spawnThread"),
15-
1, // func
15+
1, // run
1616
[&pool](jsi::Runtime& runtime, const jsi::Value& thisValue, const jsi::Value* arguments, size_t count) -> jsi::Value {
1717
auto function = arguments[0].asObject(runtime).asFunction(runtime);
1818
auto spawnThreadCallback = jsi::Function::createFromHostFunction(runtime,
@@ -23,13 +23,13 @@ void install(jsi::Runtime& runtime) {
2323
arguments[0]
2424
.asObject(runtime)
2525
.asFunction(runtime)
26-
.call(runtime, jsi::Array::createWithElements(runtime, value), 1);
26+
.call(runtime, value);
2727
};
2828
auto rejecter = [&runtime, &arguments](std::string message) {
2929
arguments[1]
3030
.asObject(runtime)
3131
.asFunction(runtime)
32-
.call(runtime, jsi::Array::createWithElements(runtime, jsi::JSError(runtime, message)), 1);
32+
.call(runtime, jsi::JSError(runtime, message).value());
3333
};
3434
// TODO: Adapt Function -> Shared Value
3535
pool.enqueue([&resolver, &rejecter]() {
@@ -48,7 +48,7 @@ void install(jsi::Runtime& runtime) {
4848
auto promise = newPromise
4949
.asObject(runtime)
5050
.asFunction(runtime)
51-
.call(runtime, jsi::Array::createWithElements(runtime, spawnThreadCallback), 1);
51+
.call(runtime, spawnThreadCallback);
5252

5353
return promise;
5454
});

example/metro.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const path = require('path');
2-
const blacklist = require('metro-config/src/defaults/blacklist');
2+
const blacklist = require('metro-config/src/defaults/exclusionList');
33
const escape = require('escape-string-regexp');
44
const pak = require('../package.json');
55

ios/RNMultithreading.mm

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ + (BOOL)requiresMainQueueSetup {
2020
- (void)setBridge:(RCTBridge *)bridge
2121
{
2222
_bridge = bridge;
23-
_setBridgeOnMainQueue = RCTIsMainQueue();
2423

2524
RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
2625
if (!cxxBridge.runtime) {

0 commit comments

Comments
 (0)