Skip to content

Commit

Permalink
Made Peer Client as private variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Valar authored and Valar committed Apr 25, 2017
1 parent 5d65d2e commit aa1933f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="col-lg-12">
<div class="modal-body">
<!-- Project Details Go Here -->
<h2>Video Call</h2>
Expand All @@ -87,8 +87,8 @@ <h2>Video Call</h2>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>

<script src="js/peer.js"></script>
<script src="js/peer-client.js"></script>
<script src="js/app.js"></script>
<script src="js/peer-client.js"></script>
</body>

</html>
12 changes: 6 additions & 6 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// UI Manager for the Chat app
function myjsapp() {
function myjsapp(peerClient) {
var chatHistory = {};
var chatPanel = {};

Expand All @@ -9,7 +9,7 @@ function myjsapp() {
$('#connect-btn').click(function (event) {
var id = $('#inputPeerUserId').val().trim();
if(id) {
connectToId(id)
peerClient.connectToId(id)
$('#inputPeerUserId').val('')
}
});
Expand Down Expand Up @@ -38,7 +38,7 @@ function myjsapp() {

$('.end-call').click(function (event) {
// End established call
endCall();
peerClient.endCall();
})
}

Expand Down Expand Up @@ -86,7 +86,7 @@ function myjsapp() {
if (13 == event.which) {
var msgText = $(this).val().trim()
if(msgText) {
sendMessage(toPeerId, msgText)
peerClient.sendMessage(toPeerId, msgText)
appendToHistory(toPeerId, msgText, true)
$(this).val('')
}
Expand All @@ -96,15 +96,15 @@ function myjsapp() {
sendBtn.click(function(event) {
var msgText = message.val().trim()
if(msgText) {
sendMessage(toPeerId, msgText)
peerClient.sendMessage(toPeerId, msgText)
appendToHistory(toPeerId, msgText, true)
message.val('').focus()
}
});

callButton.click(function (event) {
// initializeLocalVideo()
makeCall(toPeerId)
peerClient.makeCall(toPeerId)
})
// TODO - Hide panels if more than 3
},
Expand Down
11 changes: 9 additions & 2 deletions js/peer-client.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (function() {
peerapp = (function() {
'use strict';

console.log("Peer client started");
Expand Down Expand Up @@ -194,4 +194,11 @@
peer.destroy();
}
};
// })();

return {
makeCall : makeCall,
endCall : endCall,
sendMessage : sendMessage,
connectToId : connectToId
}
})();

0 comments on commit aa1933f

Please sign in to comment.