generic-lobby
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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>
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i generic-lobby

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

15.5 kB

Total Files

20

Last publish

Collaborators

  • butterdev