buttplugio / buttplug-rs-ffi

FFI from buttplug-rs to Java and other languages
Other
89 stars 22 forks source link

JS: Load WASM from a specified path #91

Open blackspherefollower opened 2 years ago

blackspherefollower commented 2 years ago

Feature Description

Right now, the path to the Buttplug JS files is fixed, so if loading the library outside of the normal browser environment (user-scripts, etc) or you want to explicitly load the JS files from your own server (without using webpack, etc), you're going to struggle.

Commit fe66645f19e43682b tried to achieve this, but actually prevented the fixed location loading from working as well as not actually working for explicit paths due to a mixed content issue (see #88 and #90)

I believe, but could be wrong, that in order for the WASM and supporting JS to be loaded, they need to be isolated from each other (no internal imports of the WASM from JS) so that the browser can perform a module import of the WASM and a separate load of the JS, otherwise the the fetch of one results in MIME type errors when the JS pulls in the WASM or vice versa.