Kill off olm-loader
Now that Olm needs to be inited asynchronously anyway, we can just pass the options to Olm.init(), and as long as we do that before we start the js-sdk, we're all good. This will means the olm js is now part of the main bundle but since it's now just a wrapper around the wasm, this is probably faster. Also add the directwatch flag to olm.wasm because otherwise it doesn't seem to copy the file in watch mode...
This commit is contained in:
parent
c511902356
commit
1f34d2d644
4 changed files with 17 additions and 58 deletions
|
@ -54,6 +54,8 @@ import SettingsStore, {SettingLevel} from "matrix-react-sdk/lib/settings/Setting
|
|||
import Tinter from 'matrix-react-sdk/lib/Tinter';
|
||||
import SdkConfig from "matrix-react-sdk/lib/SdkConfig";
|
||||
|
||||
import Olm from 'olm';
|
||||
|
||||
import rageshake from "matrix-react-sdk/lib/rageshake/rageshake";
|
||||
|
||||
import CallHandler from 'matrix-react-sdk/lib/CallHandler';
|
||||
|
@ -227,6 +229,20 @@ async function loadApp() {
|
|||
|
||||
window.addEventListener('hashchange', onHashChange);
|
||||
|
||||
/* Start loading Olm. Note that we *don't* wait for this to load: the
|
||||
* js-sdk will also call this and actually wait on the promise before it
|
||||
* tries to use the library. It can be loading its wasm while the rest of
|
||||
* the app loads though.
|
||||
*
|
||||
* We also need to tell the Olm js to look for its wasm file at the same
|
||||
* level as index.html. It really should be in the same place as the js,
|
||||
* ie. in the bundle directory, to avoid caching issues, but as far as I
|
||||
* can tell this is completely impossible with webpack.
|
||||
*/
|
||||
Olm.init({
|
||||
locateFile: () => 'olm.wasm',
|
||||
});
|
||||
|
||||
await loadLanguage();
|
||||
|
||||
const fragparts = parseQsFromFragment(window.location);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue