set debug flag at the start of worker code
This commit is contained in:
parent
d6aaa473af
commit
79061fa127
3 changed files with 11 additions and 5 deletions
8
app.js
8
app.js
|
|
@ -668,7 +668,10 @@ function concatCode(array) {
|
||||||
// in debug mode, the script should load dependent
|
// in debug mode, the script should load dependent
|
||||||
// scripts instead of serving a complete bundle
|
// scripts instead of serving a complete bundle
|
||||||
if (debug) {
|
if (debug) {
|
||||||
const code = [ '(function() { let load = [ ' ];
|
const code = [
|
||||||
|
'self.debug=true;',
|
||||||
|
'(function() { let load = [ '
|
||||||
|
];
|
||||||
direct.forEach(file => {
|
direct.forEach(file => {
|
||||||
const vers = cachever[file] || dversion || version;
|
const vers = cachever[file] || dversion || version;
|
||||||
code.push(`"/${file.replace(/\\/g,'/')}?${vers}",`);
|
code.push(`"/${file.replace(/\\/g,'/')}?${vers}",`);
|
||||||
|
|
@ -683,8 +686,7 @@ function concatCode(array) {
|
||||||
's.src = file;',
|
's.src = file;',
|
||||||
's.onload = load_next;',
|
's.onload = load_next;',
|
||||||
'document.head.appendChild(s);',
|
'document.head.appendChild(s);',
|
||||||
'} load_next(); })();',
|
'} load_next(); })();'
|
||||||
'self.debug=true;'
|
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
inject.forEach(key => {
|
inject.forEach(key => {
|
||||||
code.push(synth[key]);
|
code.push(synth[key]);
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ let KIRI = self.kiri = self.kiri || {},
|
||||||
host = loc.hostname,
|
host = loc.hostname,
|
||||||
port = loc.port,
|
port = loc.port,
|
||||||
proto = loc.protocol,
|
proto = loc.protocol,
|
||||||
|
debug = self.debug === true,
|
||||||
time = function() { return new Date().getTime() },
|
time = function() { return new Date().getTime() },
|
||||||
seqid = 1,
|
seqid = 1,
|
||||||
syncd = {},
|
syncd = {},
|
||||||
|
|
@ -57,7 +58,8 @@ KIRI.work = {
|
||||||
if (self.createWorker) {
|
if (self.createWorker) {
|
||||||
return self.createWorker();
|
return self.createWorker();
|
||||||
} else {
|
} else {
|
||||||
return new Worker(`/code/kiri_work.js?${gapp.version}`);
|
let _ = debug ? '_' : '';
|
||||||
|
return new Worker(`/code/kiri_work.js?${_}${gapp.version}`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ let BASE = self.base,
|
||||||
POLY = BASE.polygons,
|
POLY = BASE.polygons,
|
||||||
time = UTIL.time,
|
time = UTIL.time,
|
||||||
qtpi = Math.cos(Math.PI/4),
|
qtpi = Math.cos(Math.PI/4),
|
||||||
|
debug = self.debug === true,
|
||||||
ccvalue = this.navigator ? navigator.hardwareConcurrency || 0 : 0,
|
ccvalue = this.navigator ? navigator.hardwareConcurrency || 0 : 0,
|
||||||
concurrent = self.Worker && ccvalue > 3 ? ccvalue - 1 : 0,
|
concurrent = self.Worker && ccvalue > 3 ? ccvalue - 1 : 0,
|
||||||
current = self.worker = {
|
current = self.worker = {
|
||||||
|
|
@ -42,7 +43,8 @@ if (concurrent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i=0; i < concurrent; i++) {
|
for (let i=0; i < concurrent; i++) {
|
||||||
let minion = new Worker(`/code/kiri_pool.js?${self.kiri.version}`);
|
let _ = debug ? '_' : '';
|
||||||
|
let minion = new Worker(`/code/kiri_pool.js?${_}${self.kiri.version}`);
|
||||||
minion.onmessage = minhandler;
|
minion.onmessage = minhandler;
|
||||||
minions.push(minion);
|
minions.push(minion);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue