# Yatta! API

# Class: PeerJsConnector

Defined in: | lib/Connectors/PeerJsConnector.coffee

## Overview

PeerJs is a Framework that enables you to connect to other peers. You just need the user-id of the peer (browser/client). And then you can connect to it.

### See also:

- http://peerjs.com

## Instance Method Summary

- # (void) connectToPeer(id) Connect the Framework to another peer.
- # (Array<String>) getAllConnectionIds() Receive the id of every connected peer.
- # (void) onNewConnection(f)
- # (void) addConnection(conn) Adds an existing connection to this connector.

## Constructor Details

# (void) constructor(engine, HB, execution_listener, yatta)

### Parameters:

- engine ( `Engine` ) — The transformation engine
- HB ( `HistoryBuffer` )
- execution_listener ( `Array<Function>` ) — You must ensure that whenever an operation is executed, every function in this Array is called.
- yatta ( `Yatta` ) — The Yatta framework.

## Instance Method Details

# (void) connectToPeer(id)

Connect the Framework to another peer. Therefore you have to receive his user_id. If the other peer is connected to other peers, the PeerJsConnector will automatically connect to them too.

Transmitting the user_id is your job. See TextEditing for a nice example on how to do that with urls.

### Parameters:

- id ( `String` ) — Connection id

# (Array<String>) getAllConnectionIds()

Receive the id of every connected peer.

### Returns:

- ( `Array<String>` ) — A list of Peer-Ids

# (void) onNewConnection(f)

# (void) addConnection(conn)

Adds an existing connection to this connector.

### Parameters:

- conn ( `PeerJsConnection` )

Quickly fuzzy find classes, mixins, methods, file:

- T Open fuzzy finder dialog

Control the navigation frame:

- L Toggle list view
- C Show class list
- I Show mixin list
- F Show file list
- M Show method list
- E Show extras list

You can focus and blur the search input:

- S Focus search input
- Esc Blur search input