Detect Uno.Bootstrap.Wasm? #833
-
Is there a recommended approach for detecting if the consuming app of my class library is using Uno.Wasm.Bootstrap from within C#? My class library supports being consumed from either the new .NET 8 wasmbrowser template or Uno.Wasm.Bootstrap. Because wasmbrowser's ImportAsync requires ES6 modules(embedded as RCL static web assets), and Uno uses AMD modules (embedded via /WasmScripts/ folder), the best I could work out is two version of my javascript declarations needed for the library's JSImports, but this impacts how JSImport is declared: For Uno: I have two sets of all my C# proxies with each version of JSIMport. I would like to route calls to the appropriate version based on the presence of Uno.Bootstrap.Wasm. I tried checking for Uno related assemblies in CurrentDomain.GetAssemblies() but this seems like a bad approach. P.S. I tried using JSHost,ImportAsync with Uno Bootstrap, but it seems like the RCL static web assets embedded in the class library don't resolve properly under Uno. There's something in the dev server for the wasmbrowser template that allows it to resolve these requests during local development, even though the file doesn't physically exist in wwwroot anywhere at dev time. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I ended up adding a property to globalThis from my Uno specific JS loaded via WasmScripts
|
Beta Was this translation helpful? Give feedback.
You can use any of these environment variables to detect the bootstrapper: https://platform.uno/docs/articles/external/uno.wasm.bootstrap/doc/features-environment-variables.html