I'm trying to use Idris with Nativescript, by using the Idris JavaScript FFI and using JavaScript as the codegen target. However, it seems like Nativescript makes use of global variables, such as an object called global. How would I be able to work with that object from within Idris?
You can write separate getter and setter functions using FFI (both in JS_IO of course), and then you can start coming up with whatever abstractions you want to build on top of it:
getVar : JS_IO String
getVar = foreign FFI_JS "globalVar" (JS_IO String)
setVar : String -> JS_IO ()
setVar = foreign FFI_JS "globalVar = %0" (String -> JS_IO ())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With