melatonina
03/22/2017, 5:28 PMgetInfo from module ytdl-core. I have some problems when calling it but I'd like to ask you another question. I don't want to pollute the global namespace with module-specific function, so I used this syntax to declare the whole module and its function(s). @JsModule("ytdl-core")
external class Ytdl {
companion object {
fun getInfo(name: String, options : dynamic, callback : (dynamic, dynamic) -> Unit) : Unit
}
} Now I can read all javascript properties of Ytdl with Object.getOwnPropertyNames() (and getInfo in among them) but I don't know how to refer to `Ytdl.getInfo`: both Object.getOwnPropertyNames(Ytdl.getInfo) and Object.getOwnPropertyNames(Ytdl::getInfo) fail to compile. The first is assumed to be a function call (lacking its arguments), the second causes a "Unresolved reference: getInfo". Am I missing something?bashor
03/22/2017, 6:25 PMbashor
03/22/2017, 6:25 PMkonsoletyper
03/22/2017, 7:40 PMexternal object Ytdl?konsoletyper
03/22/2017, 7:44 PMgetInfo?konsoletyper
03/22/2017, 7:47 PMYtdl.Companion::getInfomelatonina
03/22/2017, 9:13 PMexternal object Ytdl was more appropriate. Sorry for all these questions that may appear to be silly to you. It's still not clear when I should use external class and when I should use external object. I'll re-read that page.melatonina
03/22/2017, 9:17 PMgetOwnPropertyNames on that function because when I was calling, it wasn't behaving as it was supposed to do. Now it seems to be working fine.