Added the multipeer connections support
This commit is contained in:
parent
4fec0ee71d
commit
99b81128fd
4 changed files with 125 additions and 78 deletions
|
|
@ -2,20 +2,12 @@
|
|||
|
||||
angular.module('cosign.join').controller('JoinController',
|
||||
function($scope, $rootScope, $routeParams, Network) {
|
||||
|
||||
$scope.connectionId = $routeParams.id;
|
||||
$scope.cosigners = [];
|
||||
$rootScope.masterId = $routeParams.id;
|
||||
|
||||
$scope.init = function() {
|
||||
console.log('-------- init --------');
|
||||
console.log($rootScope.peerId);
|
||||
$scope.cosigners.push($rootScope.peerId);
|
||||
|
||||
Network.connect($scope.connectionId, function(cosigner) {
|
||||
console.log('----- join connect --------');
|
||||
console.log(cosigner);
|
||||
$scope.cosigners.push(cosigner);
|
||||
$scope.$digest();
|
||||
});
|
||||
Network.connect($rootScope.masterId);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,21 +2,12 @@
|
|||
|
||||
angular.module('cosign.signin').controller('SigninController',
|
||||
function($scope, $rootScope, $location, Network) {
|
||||
$rootScope.peerId = null;
|
||||
$scope.peerReady = false;
|
||||
|
||||
// Init peer
|
||||
Network.init(function(pid) {
|
||||
$rootScope.peerId = pid;
|
||||
$rootScope.$digest();
|
||||
|
||||
$scope.peerReady = true;
|
||||
$scope.$digest();
|
||||
});
|
||||
Network.init();
|
||||
|
||||
$scope.join = function(cid) {
|
||||
console.log('------- join --------');
|
||||
console.log(cid);
|
||||
console.log('------- joining to ' + cid + ' --------');
|
||||
|
||||
var pid = cid || $rootScope.peerId;
|
||||
$location.path('join/' + pid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue