spierce7
01/30/2019, 3:59 PMTristan Caron
01/31/2019, 10:47 AMspierce7
01/31/2019, 6:28 PMbashor
01/31/2019, 8:39 PMbashor
01/31/2019, 8:40 PMTristan Caron
01/31/2019, 9:38 PMgaetan
01/31/2019, 9:47 PMspierce7
01/31/2019, 10:18 PMTristan Caron
02/01/2019, 11:16 AMbashor
02/01/2019, 11:58 AMTristan Caron
02/01/2019, 12:33 PMTristan Caron
02/03/2019, 11:46 PMindex.html
file which is running my code.
import kotlin.browser.document
import kotlin.browser.window
fun main() {
window.alert("Hello World!")
document.getElementById("my-button")?.addEventListener("click", {
deferredHello()
}, null)
}
deferredHello()
is coming from module B.
I don’t expect this code to work, but too fail when in click on the button. However, it’s failing before, because the compiled code look like this
(function (_, Kotlin, $module$deferredapp) {
'use strict';
var deferredHello = $module$deferredapp.deferredHello;
var Unit = Kotlin.kotlin.Unit;
function main$lambda(it) {
deferredHello();
return Unit;
}
function main() {
var tmp$;
window.alert('Hello World!');
(tmp$ = document.getElementById('my-button')) != null ? (tmp$.addEventListener('click', main$lambda, null), Unit) : null;
}
_.main = main;
main();
Kotlin.defineModule('mainapp', _);
return _;
}(module.exports, require('kotlin'), require('deferredapp')));
//# sourceMappingURL=mainapp.js.map
And deferred doesn’t exist yet.Tristan Caron
02/03/2019, 11:49 PMrequire("B.js").then(module => {
module.deferredHello()
})
But it won’t work of course