mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Drop support for webworkers
Reviewed By: AaaChiuuu Differential Revision: D4916449 fbshipit-source-id: a447233d3b7cfee98db2ce00f1c0505d513e2429
This commit is contained in:
committed by
Facebook Github Bot
parent
a20882f62e
commit
34bc6bd2ae
@@ -9,10 +9,7 @@
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A native module whose API can be provided to JS catalyst instances. {@link NativeModule}s whose
|
||||
@@ -23,7 +20,7 @@ import java.util.Map;
|
||||
*/
|
||||
public interface NativeModule {
|
||||
interface NativeMethod {
|
||||
void invoke(JSInstance jsInstance, ExecutorToken executorToken, ReadableNativeArray parameters);
|
||||
void invoke(JSInstance jsInstance, ReadableNativeArray parameters);
|
||||
String getType();
|
||||
}
|
||||
|
||||
@@ -52,27 +49,4 @@ public interface NativeModule {
|
||||
* Called before {CatalystInstance#onHostDestroy}
|
||||
*/
|
||||
void onCatalystInstanceDestroy();
|
||||
|
||||
/**
|
||||
* In order to support web workers, a module must be aware that it can be invoked from multiple
|
||||
* different JS VMs. Supporting web workers means recognizing things like:
|
||||
*
|
||||
* 1) ids (e.g. timer ids, request ids, etc.) may only unique on a per-VM basis
|
||||
* 2) the module needs to make sure to enqueue callbacks and JS module calls to the correct VM
|
||||
*
|
||||
* In order to facilitate this, modules that support web workers will have all their @ReactMethod-
|
||||
* annotated methods passed a {@link ExecutorToken} as the first parameter before any arguments
|
||||
* from JS. This ExecutorToken internally maps to a specific JS VM and can be used by the
|
||||
* framework to route calls appropriately. In order to make JS module calls correctly, start using
|
||||
* the version of {@link ReactContext#getJSModule(ExecutorToken, Class)} that takes an
|
||||
* ExecutorToken. It will ensure that any calls you dispatch to the returned object will go to
|
||||
* the right VM. For Callbacks, you don't have to do anything special -- the framework
|
||||
* automatically tags them with the correct ExecutorToken when the are created.
|
||||
*
|
||||
* Note: even though calls can come from multiple JS VMs on multiple threads, calls to this module
|
||||
* will still only occur on a single thread.
|
||||
*
|
||||
* @return whether this module supports web workers.
|
||||
*/
|
||||
boolean supportsWebWorkers();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user