It would be nice if closures in add_callback could optionally take a JsValue. The use cases for doing such would be possibly compatibility with other JS apis, but in my specific use case, I happen to want to convert a Range<usize> into a JsValue so I can blackbox the conversion logic of Range<usize> -> JsValue (as I truncate the range into two u32s and store them into a single f64 in the name of micro optimizations, and I don't want to expose that ugly logic anywhere).
Example of code that would work after this change:
It would be nice if closures in add_callback could optionally take a JsValue. The use cases for doing such would be possibly compatibility with other JS apis, but in my specific use case, I happen to want to convert a
Range<usize>
into aJsValue
so I can blackbox the conversion logic ofRange<usize>
->JsValue
(as I truncate the range into twou32
s and store them into a singlef64
in the name of micro optimizations, and I don't want to expose that ugly logic anywhere).Example of code that would work after this change: