@couchwarfare/client
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

@couchwarfare/client

import { useOnlineReducer, fetchAccessToken, timestamp } from '@couchwarfare/client'

const [accessToken, setAccessToken] = useState()
const gameId = 'RANDOMGAMEID'
const name = 'RANDOMNAME'

useEffect(() => {
    fetchAccessToken({ name }).then((v) => setAccessToken(v))
}, [])

const [state, dispatcher, readyState] = useOnlineReducer(reducer, initialArg, init, accessToken, roomId)

// Prints the timestamp. The offset will be set after calling fetchAccessToken.
console.log(timestamp())

Readme

Keywords

none

Package Sidebar

Install

npm i @couchwarfare/client

Weekly Downloads

2

Version

0.1.8

License

MIT

Unpacked Size

34.8 kB

Total Files

30

Last publish

Collaborators

  • thiagohirata