UNPKG

@logic-pad/core

Version:
20 lines (19 loc) 593 B
import { isEventHandler } from './eventHelper.js'; export function handlesSetGrid(val) { return isEventHandler(val, 'onSetGrid'); } export function invokeSetGrid(oldGrid, newGrid, solution) { newGrid.symbols.forEach(list => { list.forEach(symbol => { if (handlesSetGrid(symbol)) { newGrid = symbol.onSetGrid(oldGrid, newGrid, solution); } }); }); newGrid.rules.forEach(rule => { if (handlesSetGrid(rule)) { newGrid = rule.onSetGrid(oldGrid, newGrid, solution); } }); return newGrid; }