This package is deprecated. https://mooncakes.io/docs/moonbit-community/js-ffi should be preferred.
let a = Any::new(42)
println(a.is_number()) // true
let obj = Object::new()
obj.set("key", 100)
let val : Int = obj.get("key")
println(val) // 100let p = Promise::new(fn(resolve, _reject) {
// Simulate async work
resolve(42)
})
let _ = p.map(fn(val) { val + 1 })
.map(fn(val) { println(val) }) // Prints 43let p = Promise::from_async(async fn() {
let val = 100
val
})let x : Nullable[Int] = Nullable::new(10)
let y : Nullable[Int] = Nullable::null()
match x.to_option() {
Some(v) => println(v)
None => println("null")
}
let z : Nullish[Int] = Nullish::undefined()
// ...let a = Any::new(1)
let b = Any::new(1)
println(a == b) // truepub trait StringOrSymbol {
}impl StringOrSymbol for String#external
pub type Any#external
pub type Null#external
pub type Nullable[T]#external
pub type Nullish[T]#external
pub type Object#external
pub type Promise[T]#external
pub type Symbolimpl StringOrSymbol for Symboltype U2[T1, T2]type U3[T1, T2, T3]type U4[T1, T2, T3, T4]type U5[T1, T2, T3, T4, T5]type U6[T1, T2, T3, T4, T5, T6]type U7[T1, T2, T3, T4, T5, T6, T7]type U8[T1, T2, T3, T4, T5, T6, T7, T8]type U9[T1, T2, T3, T4, T5, T6, T7, T8, T9]#external
pub type UndefinedInstall
Download zipThis package is deprecated. https://mooncakes.io/docs/moonbit-community/js-ffi should be preferred.