I'm trying to get the currently displayed url from an Angular2 Typescript Chrome Extension. I've read this in order to get the url, and this regarding how to call Js functions in Ts. I also set allowJs to true in my tsconfig.json.
Here's my code :
ngOnInit(){
declare var tabs = chrome.tabs.query({params...},function(tabs) {
return tabs[0];
});
console.log(tabs());
}
This doesn't compile unless I remove the log.
I also tried not to use a function expression call :
declare chrome.tabs.query({'active': true, 'windowId': chrome.windows.WINDOW_ID_CURRENT},
function(tabs){}
);
But it didn't work at all. I was wondering whether it could be async related, because the code is in the OnInit.
Any ideas ?
Thanks !