Allow for room loading
This commit is contained in:
parent
21c15e5fae
commit
778daeb8ff
2 changed files with 8 additions and 6 deletions
|
@ -2,13 +2,15 @@
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import state from 'state'
|
import state from 'state'
|
||||||
|
|
||||||
export default function useLoadOnMount(roomId: string) {
|
export default function useLoadOnMount(roomId?: string) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fonts = (document as any).fonts
|
const fonts = (document as any).fonts
|
||||||
|
|
||||||
fonts.load('12px Verveine Regular', 'Fonts are loaded!').then(() => {
|
fonts.load('12px Verveine Regular', 'Fonts are loaded!').then(() => {
|
||||||
state.send('MOUNTED')
|
state.send('MOUNTED')
|
||||||
|
if (roomId !== undefined) {
|
||||||
state.send('RT_LOADED_ROOM', { id: roomId })
|
state.send('RT_LOADED_ROOM', { id: roomId })
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
@ -163,10 +163,10 @@ const state = createState({
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
// Network-Related
|
// Network-Related
|
||||||
// RT_LOADED_ROOM: [
|
RT_LOADED_ROOM: [
|
||||||
// 'clearRoom',
|
'clearRoom',
|
||||||
// { if: 'hasRoom', do: ['resetDocumentState', 'connectToRoom'] },
|
{ if: 'hasRoom', do: ['resetDocumentState', 'connectToRoom'] },
|
||||||
// ],
|
],
|
||||||
// RT_UNLOADED_ROOM: ['clearRoom', 'resetDocumentState'],
|
// RT_UNLOADED_ROOM: ['clearRoom', 'resetDocumentState'],
|
||||||
// RT_DISCONNECTED_ROOM: ['clearRoom', 'resetDocumentState'],
|
// RT_DISCONNECTED_ROOM: ['clearRoom', 'resetDocumentState'],
|
||||||
// RT_CREATED_SHAPE: 'addRtShape',
|
// RT_CREATED_SHAPE: 'addRtShape',
|
||||||
|
|
Loading…
Reference in a new issue