summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-03-20 20:54:17 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-03-20 20:54:17 +0100
commit4fb62473dff7618bc340ff6825ca9663eea0a42a (patch)
treea2163fdd93a3a587c93c698277f1f9de590c274d /objects.js
parent4f8b0e5b8c72a951aa7f240eee8fc266ee03cac5 (diff)
parent121cf8b3658909f79571b621e9a9916c7f601dfc (diff)
downloadsnap-yow-4fb62473dff7618bc340ff6825ca9663eea0a42a.tar.gz
snap-yow-4fb62473dff7618bc340ff6825ca9663eea0a42a.zip
Merge branch 'p2p' of ../Snap--Build-Your-Own-Blocks into gh-pages
Diffstat (limited to 'objects.js')
-rw-r--r--objects.js33
1 files changed, 1 insertions, 32 deletions
diff --git a/objects.js b/objects.js
index 09fd054..718d50d 100644
--- a/objects.js
+++ b/objects.js
@@ -4552,42 +4552,11 @@ StageMorph.prototype.init = function (globals) {
this.acceptsDrops = false;
this.setColor(new Color(255, 255, 255));
this.fps = this.frameRate;
-
- this.initPeering();
-};
-
-StageMorph.prototype.initPeering = function (id) {
- var myself = this;
-
- this.peer = new Peer(id, {
- host: 'snapmesh.herokuapp.com',
- port: 443,
- secure: true,
- path: '/'
- });
-
- this.peer.on('disconnected', function () {
- if (!myself.peer.destroyed && myself.peer.id) {
- myself.peer.reconnect();
- } else {
- myself.initPeering();
- }
- });
- this.peer.on('error', function (err) {
- console.log(err); // DEBUG
- });
-
- this.peer.on('connection', function (connection) {
- connection.on('open', function () {
- connection.on('data', function (data) {
- myself.newPeerMessage(data, connection.peer);
- });
- });
- });
};
StageMorph.prototype.newPeerMessage = function (data, peer) {
var ide = this.parentThatIsA(IDE_Morph);
+ if (!ide || !peer) return;
var myself = this;
var hats = [], model, message;