|
|
@ -1,28 +1,16 @@
|
|
|
|
/* jshint ignore:start */
|
|
|
|
/* jshint ignore:start */
|
|
|
|
importScripts('/bower_components/requirejs/require.js');
|
|
|
|
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;
|
|
|
|
window = self;
|
|
|
|
localStorage = {
|
|
|
|
localStorage = {
|
|
|
|
setItem: function (k, v) { localStorage[k] = v; },
|
|
|
|
setItem: function (k, v) { localStorage[k] = v; },
|
|
|
|
getItem: function (k) { return localStorage[k]; }
|
|
|
|
getItem: function (k) { return localStorage[k]; }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require([
|
|
|
|
|
|
|
|
'/common/requireconfig.js'
|
|
|
|
|
|
|
|
], function (RequireConfig) {
|
|
|
|
|
|
|
|
require.config(RequireConfig());
|
|
|
|
require([
|
|
|
|
require([
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/outer/worker-channel.js',
|
|
|
|
'/common/outer/worker-channel.js',
|
|
|
@ -31,7 +19,6 @@ require([
|
|
|
|
var msgEv = Util.mkEvent();
|
|
|
|
var msgEv = Util.mkEvent();
|
|
|
|
|
|
|
|
|
|
|
|
Channel.create(msgEv, postMessage, function (chan) {
|
|
|
|
Channel.create(msgEv, postMessage, function (chan) {
|
|
|
|
console.log('ww ready');
|
|
|
|
|
|
|
|
var clientId = '1';
|
|
|
|
var clientId = '1';
|
|
|
|
Object.keys(Rpc.queries).forEach(function (q) {
|
|
|
|
Object.keys(Rpc.queries).forEach(function (q) {
|
|
|
|
if (q === 'CONNECT') { return; }
|
|
|
|
if (q === 'CONNECT') { return; }
|
|
|
@ -48,7 +35,6 @@ require([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
chan.on('CONNECT', function (cfg, cb) {
|
|
|
|
chan.on('CONNECT', function (cfg, cb) {
|
|
|
|
console.log('onConnect');
|
|
|
|
|
|
|
|
// load Store here, with cfg, and pass a "query" (chan.query)
|
|
|
|
// load Store here, with cfg, and pass a "query" (chan.query)
|
|
|
|
// cId is a clientId used in ServiceWorker or SharedWorker
|
|
|
|
// cId is a clientId used in ServiceWorker or SharedWorker
|
|
|
|
cfg.query = function (cId, cmd, data, cb) {
|
|
|
|
cfg.query = function (cId, cmd, data, cb) {
|
|
|
@ -67,7 +53,6 @@ require([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
Rpc.queries['CONNECT'](clientId, cfg, function (data) {
|
|
|
|
Rpc.queries['CONNECT'](clientId, cfg, function (data) {
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
if (data && data.state === "ALREADY_INIT") {
|
|
|
|
if (data && data.state === "ALREADY_INIT") {
|
|
|
|
return void cb(data);
|
|
|
|
return void cb(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -110,3 +95,4 @@ require([
|
|
|
|
msgEv.fire(e);
|
|
|
|
msgEv.fire(e);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|