InAppBrowser no 'addEventListener'


#1

I’m trying to do a Facebook oAuth2 login for my NodeJS server using InAppBrowser. I’m attempting to to use the following code but I keep getting ‘browser_adapter.ts:73 TypeError: browser_1.addEventListener is not a function’ which is weird for many reasons. First off, all the demos show the same code and work fine. Second off, I NEVER declare browser_1… Just browser. Any ideas?

let browser = InAppBrowser.open('http://localhost:3000/oauth2/facebook', '_blank');
                                           browser.addEventListener('loadstart', (e) => {
                var hasToken = e.url.indexOf('?token=');
                if(hasToken < -1) return;
                var token = e.url.match("oauth_token=(.*)")[1];
                browser.close();
                console.log(token);
            });

#2

browser_1 is created during compiling/transpiling to plain javascript.

so browser_1 in .js file is browser in your ts file.