connect
connect(
channel?,options?):Promise<Play>
Waits for the host (the Fabi Play screen around the game’s frame) to start the game, and resolves with the game’s Play. Rejects after 10 seconds without a host (the page was not opened from Fabi Play or its simulator), or if the host speaks another protocol version.
Parameters
Section titled “Parameters”channel?
Section titled “channel?”options?
Section titled “options?”Returns
Section titled “Returns”Promise<Play>
Example
Section titled “Example”import { connect } from '@fabiplay/sdk'
const play = await connect()play.on('gesture', ({ player, gesture }) => gesture === 'jump' && jump(player))play.ready()