Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const queries = {
- getRoom(state: State, roomID: string) {
- return state.rooms[roomID]
- },
- isPlayerInRoom(state: State, roomID: string) {
- return state.player.roomID === roomID
- }
- }
- const newQueries = {}
- for (const [name, func] = Object.entries(queries)) {
- newQueries[name] = (...args) => func(store.getState(), ...args)
- }
- ...
- newQueries.getRoom(5)
Add Comment
Please, Sign In to add comment