mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge pull request #3578 from vector-im/dbkr/indexeddb_webworker
Add support for indexeddb sync in webworker
This commit is contained in:
commit
42e317dab8
@ -37,7 +37,18 @@
|
||||
<body style="height: 100%;">
|
||||
<section id="matrixchat" style="height: 100%;"></section>
|
||||
<noscript>Sorry, Riot requires JavaScript to be enabled.</noscript>
|
||||
<% for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) {%>
|
||||
<% for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) {
|
||||
// Not a particularly graceful way of not putting the indexeddb worker script
|
||||
// into the main page
|
||||
if (_.endsWith(htmlWebpackPlugin.files.js[i], 'indexeddb-worker.js')) {
|
||||
%>
|
||||
<script>
|
||||
window.vector_indexeddb_worker_script = '<%= htmlWebpackPlugin.files.js[i] %>';
|
||||
</script>
|
||||
<%
|
||||
continue;
|
||||
}
|
||||
%>
|
||||
<script src="<%= htmlWebpackPlugin.files.js[i] %>"></script>
|
||||
<% } %>
|
||||
<img src="img/warning.svg" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
||||
|
@ -68,11 +68,15 @@ import url from 'url';
|
||||
import {parseQs, parseQsFromFragment} from './url_utils';
|
||||
import Platform from './platform';
|
||||
|
||||
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
||||
|
||||
var lastLocationHashSet = null;
|
||||
|
||||
var CallHandler = require("matrix-react-sdk/lib/CallHandler");
|
||||
CallHandler.setConferenceHandler(VectorConferenceHandler);
|
||||
|
||||
MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
|
||||
|
||||
function checkBrowserFeatures(featureList) {
|
||||
if (!window.Modernizr) {
|
||||
console.error("Cannot check features - Modernizr global is missing.");
|
||||
|
21
src/vector/indexedbd-worker.js
Normal file
21
src/vector/indexedbd-worker.js
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {IndexedDBStoreWorker} from 'matrix-js-sdk/lib/indexeddb-worker.js';
|
||||
|
||||
const remoteWorker = new IndexedDBStoreWorker(postMessage);
|
||||
|
||||
onmessage = remoteWorker.onMessage;
|
@ -6,6 +6,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
module.exports = {
|
||||
entry: {
|
||||
"bundle": "./src/vector/index.js",
|
||||
"indexeddb-worker": "./src/vector/indexedbd-worker.js",
|
||||
|
||||
// We ship olm.js as a separate lump of javascript. This makes it get
|
||||
// loaded via a separate <script/> tag in index.html (which loads it
|
||||
|
Loading…
Reference in New Issue
Block a user