Sha256: f8af497e208f37ccee61dab823458e082b4fe0c4b57c1e8e4210882d18785004
Contents?: true
Size: 988 Bytes
Versions: 3
Compression:
Stored size: 988 Bytes
Contents
import { Controller } from "@hotwired/stimulus" export default class extends Controller { connect() { this.p2pSetup() } p2pSetup() { this.p2pFrame = this.element.closest("p2p-frame") if (this.p2pFrame) { this.p2pFrame.setP2pListener(this) } else { throw new Error("Couldn't find p2p-frame!") } } get peerId() { this.p2pFrame.peer?.peerId } get hostPeerId() { this.p2pFrame.peer?.hostPeerId } get iamHost() { this.p2pFrame.peer?.iamHost } // p2p callbacks p2pNegotiating() {} p2pConnecting() {} p2pConnected() {} p2pDisconnected() {} p2pClosed() {} p2pError() {} // send/received p2p message p2pSendMessage(message) { if (this.p2pFrame) { this.p2pFrame.sendP2pMessage(message) } } p2pReceivedMessage(message) {} }
Version data entries
3 entries across 2 versions & 1 rubygems