let _keys = {}
let _map = null

window.addEventListener('keydown', evt => {
    _keys[evt.code] = true
})

window.addEventListener('keyup', evt => {
    _keys[evt.code] = false
})

export default {
    get: key => _map ? _keys[_map[key]] : _keys[key],
    map: data => _map = data,
    all: () => _map ? Object.keys(_map).filter(key => _keys[_map[key]]) : Object.keys(_keys).filter(key => _keys[key])
}
