1.0.2 • Published 2 years ago

generic-lobby v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Generic Lobby

This is a library that adds the ability to view and join rooms within a application lobby

Installation

    npm install generic-lobby
    yarn add generic-lobby

Usage

app.tsx

    import {GenericLobby,GenericLobbyProvider} from "generic-lobby"

    cosnt myLobby = new GenericLobby({lobbyId:"my-custom-lobby"})

    const App = ()=>{
        <GenericLobbyProvider>
        <AppComponents/>
        </GenericLobbyProvider>
    }
    export default App

appcomponent.tsx

import { useGetLobby } from "generic-lobby"

const AppComponent = () => {
  const lobby = useGetLobby()
  return (
    <ul>
      {lobby.map((room) => (
        <li>
          <span>Room:{room.room}</span>
          <span>Public:{room.public}</span>
          <span>Users:{room.users}</span>
        </li>
      ))}
    </ul>
  )
}
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago