import {createStore, createApi} from 'effector'
const playerPosition = createStore(0)
const api = createApi(playerPosition, {
moveLeft: (pos, n) => pos - n,
moveRight: (pos, n) => pos + n,
})
playerPosition.watch(pos => {
console.log('position', pos)
})
api.moveRight(10)
api.moveLeft(5)