Add error message when calling sync methods from the Chrome debugger

Reviewed By: yungsters

Differential Revision: D5123286

fbshipit-source-id: a7ac3fcc0b18e8d9562d99eb60268a3d98b3d647
This commit is contained in:
Pieter De Baets 2017-05-25 06:11:30 -07:00 committed by Facebook Github Bot
parent fc45471af2
commit 7837bdbf7c
1 changed files with 6 additions and 0 deletions

View File

@ -80,6 +80,12 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) {
};
} else if (type === 'sync') {
fn = function(...args: Array<any>) {
if (__DEV__) {
invariant(global.nativeCallSyncHook, 'Calling synchronous methods on native ' +
'modules is not supported in Chrome.\n\n Consider providing alternative ' +
'methods to expose this method in debug mode, e.g. by exposing constants ' +
'ahead-of-time.');
}
return global.nativeCallSyncHook(moduleID, methodID, args);
};
} else {