Add onUnhandledMesssage handler
Summary: This diff adds the `client.onUnhandledMessage` handler, to be able to handle messages for which we don't know the names upfront. Some existing plugins that only send one kind of message can benefit from this, as can generic plugins, like the createTablePlugin Reviewed By: passy Differential Revision: D24949453 fbshipit-source-id: 0fed81e28aee350632c09ee3bb834f306dc8b100
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9a3cd63d55
commit
33e527f39a
@@ -180,6 +180,15 @@ test('a plugin can receive messages', async () => {
|
||||
},
|
||||
}
|
||||
`);
|
||||
|
||||
expect(instance.unhandledMessages.get().length).toBe(0);
|
||||
sendEvent('unhandled' as any, {hello: 'world'});
|
||||
expect(instance.unhandledMessages.get()).toEqual([
|
||||
{
|
||||
event: 'unhandled',
|
||||
params: {hello: 'world'},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test('plugins support non-serializable state', async () => {
|
||||
|
||||
Reference in New Issue
Block a user