diff --git a/app/scripts/app/controllers/index_controller.js b/app/scripts/app/controllers/index_controller.js index c082891..7702a8b 100644 --- a/app/scripts/app/controllers/index_controller.js +++ b/app/scripts/app/controllers/index_controller.js @@ -7,7 +7,7 @@ FileDrop.IndexController = Ember.ArrayController.extend({ init: function () { // Connect to PeerJS server first, // so that we already have peer ID when later joining a room. - this.set('_peer', new FileDrop.WebRTC()); + this.set('webrtc', new FileDrop.WebRTC()); // Handle room events $.subscribe('connected.room', this._onRoomConnected.bind(this)); @@ -41,7 +41,7 @@ FileDrop.IndexController = Ember.ArrayController.extend({ _onRoomUserList: function (event, data) { // Add all peers to the list and // initiate p2p connection to every one of them. - var _peer = this.get('_peer'); + var webrtc = this.get('webrtc'); data.forEach(function (attrs) { var peerAttrs = attrs.peer, @@ -52,7 +52,7 @@ FileDrop.IndexController = Ember.ArrayController.extend({ peer.get('peer').setProperties(peerAttrs); this.pushObject(peer); - _peer.connect(peer.get('peer.id')); + webrtc.connect(peer.get('peer.id')); }.bind(this)); }, @@ -127,7 +127,7 @@ FileDrop.IndexController = Ember.ArrayController.extend({ _onPeerP2PFileResponse: function (event, data) { console.log('Peer:\t Received file response', data); - var _peer = this.get('_peer'), + var webrtc = this.get('webrtc'), connection = data.connection, peer = this.findBy('peer.id', connection.peer), response = data.response, @@ -135,7 +135,7 @@ FileDrop.IndexController = Ember.ArrayController.extend({ if (response) { file = peer.get('transfer.file'); - _peer.sendFile(connection, file); + webrtc.sendFile(connection, file); } // Remove "cached" file for that peer now that we have a response diff --git a/app/scripts/app/controllers/peer_controller.js b/app/scripts/app/controllers/peer_controller.js index dcbffbb..3dbba32 100644 --- a/app/scripts/app/controllers/peer_controller.js +++ b/app/scripts/app/controllers/peer_controller.js @@ -1,7 +1,7 @@ FileDrop.PeerController = Ember.ObjectController.extend({ needs: 'index', - _peer: Ember.computed.alias('controllers.index._peer'), + webrtc: Ember.computed.alias('controllers.index.webrtc'), filename: function () { var file = this.get('model.transfer.file'), @@ -22,12 +22,12 @@ FileDrop.PeerController = Ember.ObjectController.extend({ }, sendFileTransferInquiry: function () { - var _peer = this.get('_peer'), + var webrtc = this.get('webrtc'), peer = this.get('model'), connection = peer.get('peer.connection'), file = peer.get('transfer.file'); - _peer.sendFileInfo(connection, file); + webrtc.sendFileInfo(connection, file); console.log('Sending a file...', file); }, @@ -53,10 +53,10 @@ FileDrop.PeerController = Ember.ObjectController.extend({ }, _sendFileTransferResponse: function (response) { - var _peer = this.get('_peer'), + var webrtc = this.get('webrtc'), peer = this.get('model'), connection = peer.get('peer.connection'); - _peer.sendFileResponse(connection, response); + webrtc.sendFileResponse(connection, response); } });