requestIdleCallback node fallback
Summary: requestIdleCallback does not exist in node.js. In this case, we immediately invoke the callback. Reviewed By: priteshrnandgaonkar Differential Revision: D15556037 fbshipit-source-id: 62cee8544fabd4528d9df17109e882fa9db6585f
This commit is contained in:
committed by
Facebook Github Bot
parent
bec5c2b20c
commit
565b8995ae
@@ -110,9 +110,17 @@ export default class Client extends EventEmitter {
|
|||||||
this.activePlugins = new Set();
|
this.activePlugins = new Set();
|
||||||
|
|
||||||
const client = this;
|
const client = this;
|
||||||
|
// node.js doesn't support requestIdleCallback
|
||||||
|
const rIC =
|
||||||
|
typeof requestIdleCallback === 'undefined'
|
||||||
|
? (cb, options) => {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
: requestIdleCallback;
|
||||||
|
|
||||||
this.responder = {
|
this.responder = {
|
||||||
fireAndForget: (payload: {data: string}) =>
|
fireAndForget: (payload: {data: string}) =>
|
||||||
requestIdleCallback(
|
rIC(
|
||||||
() => {
|
() => {
|
||||||
const mark = 'onMessageCallback';
|
const mark = 'onMessageCallback';
|
||||||
performance.mark();
|
performance.mark();
|
||||||
|
|||||||
Reference in New Issue
Block a user