kotlinJS chrome extension get active tab url

I tried to follow a tutorial to create a chrome extension (https://github.com/apatrida/kotlin-example-chrome-ext/blob/master/src/main/kotlin/com/collokia/browserplugin/chrome/GoogleImageTest/Extension.kt)

But it seems to be outdated for the latest kotlinjs version.

I’m trying to get the active tab URL with this code

fun getActiveTabURL(): String {
var url = "NotInit"
chrome.tabs.query(chrome_tabs_CurrentTabQuery()) {
    tabs ->
        println("tabsssssssss")
        url = tabs[0].url ?: "NULL"
        println("print url $url")

}
println(url)
return url

}

But it doesn’t seems to work the tutorial uses keywords like native but I can’t use them on my IDE (IntelliJ)

external object chrome {
object tabs {
    object Tab {
        var status: String?
        var index: Number
        var openerTabId: Number?
        var title: String?
        var url: String?
        var pinned: Boolean
        var highlighted: Boolean
        var windowId: Number
        var active: Boolean
        var favIconUrl: String?
        var id: Number
        var incognito: Boolean
    }
    public fun query(queryInfo: Any, callback: (result: Array) -> Unit): Unit = definedExternally
}
}

class chrome_tabs_CurrentTabQuery() {
val active = true;
val currentWindow = true
}

Do you know what’s wrong or a more recent example?
I obtain a

Uncaught TypeError: Cannot read property 'query' of undefined
at getActiveTabURL (kotlinextensiontest.js:61)
at main (kotlinextensiontest.js:20)
at kotlinextensiontest.js:122
at kotlinextensiontest.js:125