igorlukanin
03/25/2016, 4:10 PMigorlukanin
03/25/2016, 4:10 PMbashor
03/25/2016, 4:10 PMnew Promise….
but our imported Promise in var with qualified name _.package.Promisejw
03/25/2016, 4:11 PMigorlukanin
03/25/2016, 4:11 PMvar Promise = require("promise");
var new_Promise = function(callback) {
return new Promise(callback)
};
2. In Kotlin:
@native fun new_Promise(callback: ((Any), (Any)) -> Unit)
igorlukanin
03/25/2016, 4:12 PMbashor
03/25/2016, 4:12 PM@native
fun new(d: dynamic): dynamic = noImpl
var foo = new(Promise)({ … })
igorlukanin
03/25/2016, 4:13 PMbashor
03/25/2016, 4:15 PMnew_Promise
from prefix.js and use declaration from @konsoletyperbashor
03/25/2016, 4:15 PMvar Promise = require("promise”);
kotlin:
kotlin
@native class Promise<T>(f: (resolve: (T) -> Unit, reject: (dynamic) -> Unit) -> Unit) {
fun then(onFulfilled: (T) -> Unit, onRejected: (dynamic) -> Unit = { }): Promise<T> = noImpl
}
//….
var foo = new Promise<Int>({ …. })
bashor
03/25/2016, 4:17 PMigorlukanin
03/25/2016, 4:18 PMigorlukanin
03/25/2016, 4:19 PMsdeleuze
03/25/2016, 7:53 PMsdeleuze
03/25/2016, 7:53 PMbashor
03/27/2016, 1:37 PMdynamicNew(dyn, arg1, arg2)
to new dyn(arg1, arg2)
bashor
03/27/2016, 1:38 PMfun dynamicNew(dyn: dynamic, vararg args: dynamic): dynamic {
val instance = js("Object.create(dyn.prototype)")
dyn.apply(instance, args)
return instance
}
bashor
03/27/2016, 1:52 PMinline fun dynamicNew2(dyn: dynamic, arg1: dynamic): dynamic {
return js("new dyn(arg1)")
}
inline fun dynamicNew2(dyn: dynamic, arg1: dynamic, arg2: dynamic): dynamic {
return js("new dyn(arg1, arg2)")
}
igorlukanin
03/27/2016, 1:55 PMsdeleuze
04/06/2016, 4:21 PMsdeleuze
04/06/2016, 4:22 PMbashor
04/06/2016, 4:22 PMsdeleuze
04/06/2016, 4:23 PMbashor
04/06/2016, 4:24 PMylemoigne
04/10/2016, 9:03 PMdebug
04/21/2016, 6:41 PMsdeleuze
04/27/2016, 11:55 AMsdeleuze
04/27/2016, 11:56 AMsdeleuze
04/27/2016, 11:57 AMkonsoletyper
04/27/2016, 12:02 PM