Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
run(el) {
const chess = new Chess();
const cg = chessground(el, {
movable: {
color: 'white',
free: false,
dests: toDests(chess)
}
});
cg.set({
// draggable: {
// showGhost: false
// },
movable: {
events: {
after(orig, dest) {
chess.move({from: orig, to: dest});
cg.set({
turnColor: toColor(chess),
run(cont) {
const cg = chessground(cont, {
movable: {
free: false,
dests: {
e2: ['e3', 'e4', 'd3', 'f3']
}
}
});
const el = cont.querySelector('.cg-board') as HTMLElement;
const delay = 500;
function run() {
if (!el.offsetParent) return;
cg.selectSquare('e2');
setTimeout(() => {
cg.selectSquare('d4');
setTimeout(run, delay);
}, delay);
run(cont) {
const cg = chessground(cont, {
animation: { duration: 500 }
});
const el = cont.querySelector('.cg-board') as HTMLElement;
const delay = 400;
function run() {
if (!el.offsetParent) return;
cg.move('e2', 'd4');
setTimeout(() => {
cg.move('d4', 'e2');
setTimeout(run, delay);
}, delay);
}
setTimeout(run, delay);
return cg;
}
};
run(el) {
return Chessground(el);
}
};