remove changes to storage listen
And emit on first stockfish emit.
This commit is contained in:
parent
0981e97259
commit
808a2bb3be
|
@ -69,12 +69,17 @@ export default function(opts: CevalOpts): CevalController {
|
|||
};
|
||||
})();
|
||||
|
||||
let lastEmitFen: string | null = null;
|
||||
|
||||
const onEmit = throttle(500, false, (ev: Tree.ClientEval, work: Work) => {
|
||||
sortPvsInPlace(ev.pvs, (work.ply % 2 === (work.threatMode ? 1 : 0)) ? 'white' : 'black');
|
||||
npsRecorder(ev);
|
||||
curEval = ev;
|
||||
opts.emit(ev, work);
|
||||
if (ev.millis > 1000 && ev.millis < 5000) window.lichess.storage.set('ceval.fen', ev.fen);
|
||||
if (ev.fen !== lastEmitFen) {
|
||||
lastEmitFen = ev.fen;
|
||||
window.lichess.storage.set('ceval.fen', ev.fen);
|
||||
}
|
||||
});
|
||||
|
||||
const effectiveMaxDepth = function(): number {
|
||||
|
|
|
@ -49,7 +49,7 @@ lichess.storage = (function() {
|
|||
},
|
||||
listen: function(f) {
|
||||
window.addEventListener('storage', function(e) {
|
||||
if (e.key === k && e.newValue !== null && e.newValue !== e.oldValue) f(e);
|
||||
if (e.key === k && e.newValue !== null) f(e);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue