handle messages in idleCallback
Summary: When receiving a message from the device, the parsing and updating is now handled in an idleCallback, with a timeout of 500ms. Reviewed By: passy Differential Revision: D15469094 fbshipit-source-id: c3fc70c2f082930a1a0a01078732cfd45297c391
This commit is contained in:
committed by
Facebook Github Bot
parent
0d769aa1c2
commit
dd2d309c0c
@@ -111,9 +111,10 @@ export default class Client extends EventEmitter {
|
|||||||
|
|
||||||
const client = this;
|
const client = this;
|
||||||
this.responder = {
|
this.responder = {
|
||||||
fireAndForget: (payload: {data: string}) => {
|
fireAndForget: (payload: {data: string}) =>
|
||||||
client.onMessage(payload.data);
|
requestIdleCallback(() => client.onMessage(payload.data), {
|
||||||
},
|
timeout: 500,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (conn) {
|
if (conn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user