Fix cache and merge issues
This commit is contained in:
parent
305b47132c
commit
48dc8c78b4
@ -769,8 +769,10 @@ define([
|
||||
var postMsg, worker;
|
||||
Nthen(function (waitFor2) {
|
||||
if (SharedWorker) {
|
||||
worker = new SharedWorker('/common/outer/sharedworker.js' + urlArgs);
|
||||
console.log(worker);
|
||||
worker = new SharedWorker('/common/outer/sharedworker.js?' + urlArgs);
|
||||
worker.onerror = function (e) {
|
||||
console.error(e);
|
||||
};
|
||||
worker.port.onmessage = function (ev) {
|
||||
if (ev.data === "SW_READY") {
|
||||
return;
|
||||
@ -789,7 +791,7 @@ define([
|
||||
if (worker) { return void worker.postMessage(data); }
|
||||
};
|
||||
|
||||
navigator.serviceWorker.register('/common/outer/serviceworker.js' + urlArgs, {scope: '/'})
|
||||
navigator.serviceWorker.register('/common/outer/serviceworker.js?' + urlArgs, {scope: '/'})
|
||||
.then(function(reg) {
|
||||
// Add handler for receiving messages from the service worker
|
||||
navigator.serviceWorker.addEventListener('message', function (ev) {
|
||||
@ -829,7 +831,7 @@ define([
|
||||
/**/console.log('Registration failed with ' + error);
|
||||
});
|
||||
} else if (Worker) {
|
||||
worker = new Worker('/common/outer/webworker.js' + urlArgs);
|
||||
worker = new Worker('/common/outer/webworker.js?' + urlArgs);
|
||||
worker.onmessage = function (ev) {
|
||||
msgEv.fire(ev);
|
||||
};
|
||||
|
||||
@ -1049,7 +1049,7 @@ define([
|
||||
channel.queue.forEach(function (data) {
|
||||
channel.sendMessage(data.message, clientId);
|
||||
});
|
||||
postMessage("PAD_CONNECT", {
|
||||
channel.bcast("PAD_CONNECT", {
|
||||
myID: wc.myID,
|
||||
id: wc.id,
|
||||
members: wc.members
|
||||
|
||||
@ -1,22 +1,5 @@
|
||||
/* 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 = {
|
||||
@ -24,17 +7,22 @@ localStorage = {
|
||||
getItem: function (k) { return localStorage[k]; }
|
||||
};
|
||||
|
||||
self.tabs = {};
|
||||
|
||||
var postMsg = function (client, data) {
|
||||
client.postMessage(data);
|
||||
};
|
||||
|
||||
|
||||
var debug = function (msg) { console.log(msg); };
|
||||
// debug = function () {};
|
||||
|
||||
var init = function (client, cb) {
|
||||
debug('SW INIT');
|
||||
|
||||
require([
|
||||
'/common/requireconfig.js'
|
||||
], function (RequireConfig) {
|
||||
require.config(RequireConfig());
|
||||
require([
|
||||
'/common/common-util.js',
|
||||
'/common/outer/worker-channel.js',
|
||||
@ -138,9 +126,9 @@ var init = function (client, cb) {
|
||||
|
||||
self.tabs[client.id].msgEv = msgEv;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
self.tabs = {};
|
||||
self.addEventListener('message', function (e) {
|
||||
var cId = e.source.id;
|
||||
if (e.data === "INIT") {
|
||||
|
||||
@ -1,23 +1,5 @@
|
||||
console.log('SW!');
|
||||
/* 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 = {
|
||||
@ -26,16 +8,6 @@ localStorage = {
|
||||
};
|
||||
|
||||
self.tabs = {};
|
||||
var findTab = function (port) {
|
||||
var tab;
|
||||
Object.keys(self.tabs).some(function (id) {
|
||||
if (self.tabs[id].port === port) {
|
||||
tab = port;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return tab;
|
||||
};
|
||||
|
||||
var postMsg = function (client, data) {
|
||||
client.port.postMessage(data);
|
||||
@ -47,6 +19,10 @@ var debug = function (msg) { console.log(msg); };
|
||||
var init = function (client, cb) {
|
||||
debug('SharedW INIT');
|
||||
|
||||
require([
|
||||
'/common/requireconfig.js'
|
||||
], function (RequireConfig) {
|
||||
require.config(RequireConfig());
|
||||
require([
|
||||
'/common/common-util.js',
|
||||
'/common/outer/worker-channel.js',
|
||||
@ -152,10 +128,11 @@ var init = function (client, cb) {
|
||||
|
||||
client.msgEv = msgEv;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
onconnect = function(e) {
|
||||
debug('New ShardWorker client');
|
||||
debug('New SharedWorker client');
|
||||
var port = e.ports[0];
|
||||
var cId = Number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER))
|
||||
var client = self.tabs[cId] = {
|
||||
@ -176,29 +153,3 @@ onconnect = function(e) {
|
||||
};
|
||||
};
|
||||
|
||||
self.tabs = {};
|
||||
self.addEventListener('message', function (e) {
|
||||
var cId = e.source.id;
|
||||
if (e.data === "INIT") {
|
||||
if (tabs[cId]) { return; }
|
||||
tabs[cId] = {
|
||||
client: e.source
|
||||
};
|
||||
init(e.source, function () {
|
||||
postMsg(e.source, 'SW_READY');
|
||||
});
|
||||
} else if (self.tabs[cId] && self.tabs[cId].msgEv) {
|
||||
self.tabs[cId].msgEv.fire(e);
|
||||
}
|
||||
});
|
||||
self.addEventListener('install', function (e) {
|
||||
debug('V1 installing…');
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('activate', function (e) {
|
||||
debug('V1 now ready to handle fetches!');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user