I have some trouble with this task in the setInterval callback.
This is my Error:
- setInterval should be called from startMiningGame and run handleStateChange every second
And this is my gameEngine.js:
import { init } from './functions.js';
import { handleKeyPress, handleStateChange } from './handlers';
export const startMiningGame = (term, state) => {
init(term);
term.on('key', (name, matches, data) => {
state.gold++;
});
handleKeyPress(term, state);
setInterval(() => {
handleStateChange(term, state);
}, 1000);
}
Can anyone help me with this?