mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
js: add fixes for generic structures and functions; add promise API; refactor modules (#12575)
This commit is contained in:
parent
ac3910b8c2
commit
f584e70cf2
11 changed files with 1170 additions and 54 deletions
16
vlib/js/promise/promise_test.js.v
Normal file
16
vlib/js/promise/promise_test.js.v
Normal file
|
@ -0,0 +1,16 @@
|
|||
fn test_promise() {
|
||||
// TODO: For some reason compiler errors: "error: unknown function: js.promise.new", fix this
|
||||
/*
|
||||
p := promise.new<int, f64>(fn (resolve_ fn (x int), reject_ fn (x f64)) {
|
||||
println('Promise code')
|
||||
assert true
|
||||
resolve_(42)
|
||||
})
|
||||
p.then(fn (val int) {
|
||||
println('resolved')
|
||||
assert val == 42
|
||||
}, fn (fail f64) {
|
||||
println('rejected')
|
||||
assert false
|
||||
})*/
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue