How to use the matrix-react-sdk/lib/PlatformPeg.set function in matrix-react-sdk

To help you get started, we’ve selected a few matrix-react-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vector-im / riot-web / test / app-tests / loading.js View on Github external
const config = Object.assign({
            default_hs_url: DEFAULT_HS_URL,
            default_is_url: DEFAULT_IS_URL,
            validated_server_config: makeType(ValidatedServerConfig, {
                hsUrl: DEFAULT_HS_URL,
                hsName: "TEST_ENVIRONMENT",
                hsNameIsDifferent: false, // yes, we lie
                isUrl: DEFAULT_IS_URL,
            }),
            embeddedPages: {
                homeUrl: 'data:text/html;charset=utf-8;base64,PGh0bWw+PC9odG1sPg==',
            },
        }, opts.config || {});

        PlatformPeg.set(new WebPlatform());

        const params = parseQs(windowLocation);

        tokenLoginCompletePromise = new Promise(resolve => {
            matrixChat = ReactDOM.render(
                 {throw new Error('Not implemented');}}
                />, parentDiv,
github vector-im / riot-web / test / app-tests / joining.js View on Github external
const ROOM_ID = '!id:localhost';

            httpBackend.when('GET', '/pushrules').respond(200, {});
            httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' });

            // note that we deliberately do *not* set an expectation for a
            // presence update - setting one makes the first httpBackend.flush
            // return before the first /sync arrives.

            // start with a logged-in client
            localStorage.setItem("mx_hs_url", HS_URL );
            localStorage.setItem("mx_is_url", IS_URL );
            localStorage.setItem("mx_access_token", ACCESS_TOKEN );
            localStorage.setItem("mx_user_id", USER_ID);

            PlatformPeg.set(new WebPlatform());

            const config = {
                validated_server_config: makeType(ValidatedServerConfig, {
                    hsUrl: HS_URL,
                    hsName: "TEST_ENVIRONMENT",
                    hsNameIsDifferent: false, // yes, we lie
                    isUrl: IS_URL,
                }),
            };

            const mc = (
                {throw new Error("unimplemented");}}
                    initialScreenAfterLogin={{
github vector-im / riot-web / src / vector / index.js View on Github external
// indexeddb directly with no worker script, but we want to
        // make sure the indexeddb script is present, so fail hard.
        throw new Error("Missing indexeddb worker script!");
    }
    MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
    CallHandler.setConferenceHandler(VectorConferenceHandler);

    window.addEventListener('hashchange', onHashChange);

    await loadOlm();

    // set the platform for react sdk
    if (window.ipcRenderer) {
        console.log("Using Electron platform");
        const plaf = new ElectronPlatform();
        PlatformPeg.set(plaf);
    } else {
        console.log("Using Web platform");
        PlatformPeg.set(new WebPlatform());
    }

    const platform = PlatformPeg.get();

    let configJson;
    let configError;
    let configSyntaxError = false;
    try {
        configJson = await platform.getConfig();
    } catch (e) {
        configError = e;

        if (e && e.err && e.err instanceof SyntaxError) {
github vector-im / riot-web / src / vector / index.js View on Github external
}
    MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
    CallHandler.setConferenceHandler(VectorConferenceHandler);

    window.addEventListener('hashchange', onHashChange);

    await loadOlm();

    // set the platform for react sdk
    if (window.ipcRenderer) {
        console.log("Using Electron platform");
        const plaf = new ElectronPlatform();
        PlatformPeg.set(plaf);
    } else {
        console.log("Using Web platform");
        PlatformPeg.set(new WebPlatform());
    }

    const platform = PlatformPeg.get();

    let configJson;
    let configError;
    let configSyntaxError = false;
    try {
        configJson = await platform.getConfig();
    } catch (e) {
        configError = e;

        if (e && e.err && e.err instanceof SyntaxError) {
            console.error("SyntaxError loading config:", e);
            configSyntaxError = true;
            configJson = {}; // to prevent errors between here and loading CSS for the error box