Fix cache issues
parent
953d98be96
commit
598d56c75e
|
@ -16,13 +16,14 @@ define([
|
|||
Messaging, Constants, Feedback, LocalStore, /*AStore, */Channel,
|
||||
AppConfig, Nthen) {
|
||||
|
||||
|
||||
/* This file exposes functionality which is specific to Cryptpad, but not to
|
||||
any particular pad type. This includes functions for committing metadata
|
||||
about pads to your local storage for future use and improved usability.
|
||||
|
||||
Additionally, there is some basic functionality for import/export.
|
||||
*/
|
||||
var urlArgs = Util.find(Config, ['requireConf', 'urlArgs']) || '';
|
||||
|
||||
var postMessage = function (/*cmd, data, cb*/) {
|
||||
/*setTimeout(function () {
|
||||
AStore.query(cmd, data, cb);
|
||||
|
@ -885,7 +886,7 @@ define([
|
|||
}));*/
|
||||
|
||||
var msgEv = Util.mkEvent();
|
||||
var worker = new Worker('/common/outer/webworker.js');
|
||||
var worker = new Worker('/common/outer/webworker.js?' + urlArgs);
|
||||
worker.onmessage = function (ev) {
|
||||
msgEv.fire(ev);
|
||||
};
|
||||
|
|
|
@ -1,63 +1,52 @@
|
|||
/* jshint ignore:start */
|
||||
importScripts('/bower_components/requirejs/require.js');
|
||||
require.config({
|
||||
// fix up locations so that relative urls work.
|
||||
baseUrl: '/',
|
||||
paths: {
|
||||
// jquery declares itself as literally "jquery" so it cannot be pulled by path :(
|
||||
"jquery": "/bower_components/jquery/dist/jquery.min",
|
||||
// json.sortify same
|
||||
"json.sortify": "/bower_components/json.sortify/dist/JSON.sortify",
|
||||
cm: '/bower_components/codemirror'
|
||||
},
|
||||
map: {
|
||||
'*': {
|
||||
'css': '/bower_components/require-css/css.js',
|
||||
'less': '/common/RequireLess.js',
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window = self;
|
||||
localStorage = {
|
||||
setItem: function (k, v) { localStorage[k] = v; },
|
||||
getItem: function (k) { return localStorage[k]; }
|
||||
};
|
||||
|
||||
require([
|
||||
'/common/common-util.js',
|
||||
'/common/outer/worker-channel.js',
|
||||
'/common/outer/store-rpc.js'
|
||||
], function (Util, Channel, Rpc) {
|
||||
var msgEv = Util.mkEvent();
|
||||
'/common/requireconfig.js'
|
||||
], function (RequireConfig) {
|
||||
require.config(RequireConfig());
|
||||
require([
|
||||
'/common/common-util.js',
|
||||
'/common/outer/worker-channel.js',
|
||||
'/common/outer/store-rpc.js'
|
||||
], function (Util, Channel, Rpc) {
|
||||
var msgEv = Util.mkEvent();
|
||||
|
||||
Channel.create(msgEv, postMessage, function (chan) {
|
||||
console.log('ww ready');
|
||||
Object.keys(Rpc.queries).forEach(function (q) {
|
||||
if (q === 'CONNECT') { return; }
|
||||
chan.on(q, function (data, cb) {
|
||||
try {
|
||||
Rpc.queries[q](data, cb);
|
||||
} catch (e) {
|
||||
console.error('Error in webworker when executing query ' + q);
|
||||
console.error(e);
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
chan.on('CONNECT', function (cfg, cb) {
|
||||
console.log('onConnect');
|
||||
// load Store here, with cfg, and pass a "query" (chan.query)
|
||||
cfg.query = function (cmd, data, cb) {
|
||||
chan.query(cmd, data, function (err, data) {
|
||||
if (err) { return void cb({error: err}); }
|
||||
cb(data);
|
||||
Channel.create(msgEv, postMessage, function (chan) {
|
||||
console.log('ww ready');
|
||||
Object.keys(Rpc.queries).forEach(function (q) {
|
||||
if (q === 'CONNECT') { return; }
|
||||
chan.on(q, function (data, cb) {
|
||||
try {
|
||||
Rpc.queries[q](data, cb);
|
||||
} catch (e) {
|
||||
console.error('Error in webworker when executing query ' + q);
|
||||
console.error(e);
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
Rpc.queries['CONNECT'](cfg, cb);
|
||||
});
|
||||
}, true);
|
||||
});
|
||||
chan.on('CONNECT', function (cfg, cb) {
|
||||
console.log('onConnect');
|
||||
// load Store here, with cfg, and pass a "query" (chan.query)
|
||||
cfg.query = function (cmd, data, cb) {
|
||||
chan.query(cmd, data, function (err, data) {
|
||||
if (err) { return void cb({error: err}); }
|
||||
cb(data);
|
||||
});
|
||||
};
|
||||
Rpc.queries['CONNECT'](cfg, cb);
|
||||
});
|
||||
}, true);
|
||||
|
||||
onmessage = function (e) {
|
||||
msgEv.fire(e);
|
||||
};
|
||||
onmessage = function (e) {
|
||||
msgEv.fire(e);
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue