forked from matrix/element-web
move rageshake init into init.ts to allow for code-splitting
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
7b930da343
commit
37ed89c25f
|
@ -25,7 +25,6 @@ require('gfm.css/gfm.css');
|
|||
require('highlight.js/styles/github.css');
|
||||
|
||||
// These are things that can run before the skin loads - be careful not to reference the react-sdk though.
|
||||
import './rageshakesetup';
|
||||
import './modernizr';
|
||||
|
||||
// load service worker if available on this platform
|
||||
|
@ -33,16 +32,26 @@ if ('serviceWorker' in navigator) {
|
|||
navigator.serviceWorker.register('sw.js');
|
||||
}
|
||||
|
||||
async function settled(prom) {
|
||||
try {
|
||||
await prom;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
// React depends on Map & Set which we check for using modernizr's es6collections
|
||||
// if modernizr fails we may not have a functional react to show the error message.
|
||||
// try in react but fallback to an `alert`
|
||||
async function start() {
|
||||
// load init.ts async so that its code is not executed immediately and we can catch any exceptions
|
||||
const {loadSkin, loadApp} = await import(
|
||||
const {rageshakePromise, loadSkin, loadApp} = await import(
|
||||
/* webpackChunkName: "init" */
|
||||
/* webpackPreload: true */
|
||||
"./init");
|
||||
|
||||
await settled(rageshakePromise); // give rageshake a chance to load/fail
|
||||
|
||||
await loadSkin();
|
||||
await loadApp();
|
||||
}
|
||||
|
|
|
@ -21,13 +21,17 @@ limitations under the License.
|
|||
import olmWasmPath from "olm/olm.wasm";
|
||||
import Olm from 'olm';
|
||||
|
||||
import * as languageHandler from 'matrix-react-sdk/src/languageHandler';
|
||||
import * as languageHandler from "matrix-react-sdk/src/languageHandler";
|
||||
import SettingsStore from "matrix-react-sdk/src/settings/SettingsStore";
|
||||
import ElectronPlatform from "./platform/ElectronPlatform";
|
||||
import WebPlatform from "./platform/WebPlatform";
|
||||
import PlatformPeg from 'matrix-react-sdk/src/PlatformPeg';
|
||||
import PlatformPeg from "matrix-react-sdk/src/PlatformPeg";
|
||||
import SdkConfig from "matrix-react-sdk/src/SdkConfig";
|
||||
|
||||
import { initRageshake } from "./rageshakesetup";
|
||||
|
||||
|
||||
export const rageshakePromise = initRageshake();
|
||||
|
||||
export function preparePlatform() {
|
||||
if ((<any>window).ipcRenderer) {
|
||||
|
|
|
@ -30,7 +30,7 @@ import * as rageshake from "matrix-react-sdk/src/rageshake/rageshake";
|
|||
import SdkConfig from "matrix-react-sdk/src/SdkConfig";
|
||||
import sendBugReport from "matrix-react-sdk/src/rageshake/submit-rageshake";
|
||||
|
||||
function initRageshake() {
|
||||
export function initRageshake() {
|
||||
rageshake.init().then(() => {
|
||||
console.log("Initialised rageshake.");
|
||||
console.log("To fix line numbers in Chrome: " +
|
||||
|
@ -48,8 +48,6 @@ function initRageshake() {
|
|||
});
|
||||
}
|
||||
|
||||
initRageshake();
|
||||
|
||||
window.mxSendRageshake = function(text: string, withLogs?: boolean) {
|
||||
if (withLogs === undefined) withLogs = true;
|
||||
if (!text || !text.trim()) {
|
||||
|
|
Loading…
Reference in New Issue