From f98eb7a4eced8b64c853d8d96265d0facfb803b1 Mon Sep 17 00:00:00 2001 From: Michel Albers Date: Wed, 25 Oct 2017 18:16:23 +0200 Subject: [PATCH] Fix "realm constructor not defined" in JS remote debugging mode --- lib/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/index.js b/lib/index.js index 813cde3a..95de52d2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -51,6 +51,13 @@ function getContext() { return 'chromedebugger'; } + + // Check if its in remote js debugging mode + // https://stackoverflow.com/a/42839384/3090989 + if (typeof atob !== 'undefined') { + return 'chromedebugger'; + } + // Otherwise, we must be in a "normal" react native situation. // In that case, the Realm type should have been injected by the native code. // If it hasn't, the user likely forgot to run link.