Skip to content

Instantly share code, notes, and snippets.

@dmackerman dmackerman/blah.js Secret
Last active Aug 29, 2015

Embed
What would you like to do?
var app = angular.module('apptui', ['ionic'])
app.controller('ComputerListController', ['$scope', ComputerListController);
function ComputerListController($scope) {
$scope.computers = [];
$scope.debug = "im here bro";
Bonjour.browse(
'_apptui-http._tcp',
'local',
foundNewComputer,
lostComputer
);
$scope.$on('computerEvent', function(result) {
if (result.action == 'added') {
$scope.computers.push(result.computer);
}
// etc
});
function foundNewComputer(newComputer) {
// foundNewComputer can be any name.
$scope.$emit('computerEvent', {
action: 'added',
computer: newComputer
});
}
function lostComputer(computer) {
$scope.$emit('computerEvent', {
action: 'lost',
computer: newComputer
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.