Make sure callbacks are not reused and reloading works
Summary: This diff is part of the bigger task T60496135 This diff changes the RN support from crude to decent citizen, making sure we don't recycle callbacks over the bridge, use subscriptions were possible, and making sure connecting, disconnecting, etc works correctly For example, connect and disconnect hooks should work. Finally, throw in hot reloading into the mix, which causes the registerPlugin to be triggered another time, without the old one every been unloaded. This should trigger a new 'onConnect' on the client, to make sure it can restore any state / subscriptions necessary, even though the never disappeared in the Java world. These cases should all be handled well. Reviewed By: jknoxville Differential Revision: D19347330 fbshipit-source-id: de64a08f4043f01528c794430ccc3c717abf0180
This commit is contained in:
committed by
Facebook Github Bot
parent
c7158f4517
commit
08e2d54f62
15
react-native/react-native-flipper/index.d.ts
vendored
15
react-native/react-native-flipper/index.d.ts
vendored
@@ -57,12 +57,13 @@ declare namespace Flipper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal api to connect to the native Java module, not to be used directly
|
||||
*/
|
||||
declare module 'Flipper' {
|
||||
export function registerPlugin(
|
||||
pluginId: string,
|
||||
runInBackground: boolean,
|
||||
onConnect: () => void,
|
||||
onDisconnect: () => void,
|
||||
): void;
|
||||
export function send(pluginId: string, method: string, data: string): void;
|
||||
export function reportErrorWithMetadata(
|
||||
@@ -71,13 +72,13 @@ declare module 'Flipper' {
|
||||
stackTrace: string,
|
||||
): void;
|
||||
export function reportError(pluginId: string, error: string): void;
|
||||
export function subscribe(
|
||||
pluginId: string,
|
||||
method: string,
|
||||
listener: (data: string, responderId: number) => void,
|
||||
): void;
|
||||
export function subscribe(pluginId: string, method: string): void;
|
||||
export function respondSuccess(responderId: string, data?: string): void;
|
||||
export function respondError(responderId: string, error: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new plugin
|
||||
* @param plugin
|
||||
*/
|
||||
export function addPlugin(plugin: Flipper.FlipperPlugin): void;
|
||||
|
||||
Reference in New Issue
Block a user