Skip to content

Instantly share code, notes, and snippets.

@gogromat
Created February 20, 2013 21:30
Show Gist options
  • Save gogromat/4999807 to your computer and use it in GitHub Desktop.
Save gogromat/4999807 to your computer and use it in GitHub Desktop.
var AllHosts = function() {
var host_items = [];
return {
setHost: function(host) {
host_items.push(host);
},
hasHost: function(id) {
var hasMe = false;
$.each(host_items, function(i, host) {
if (parseInt(host.host_id) === parseInt(id)) {
hasMe = true;
return false;
}
});
return hasMe;
},
getHost: function(id) {
var theHost = [];
$.each(host_items,function(i, host) {
if (parseInt(host.host_id) === parseInt(id)) {
theHost = host;
return false;
}
});
return theHost;
},
getHosts: function() {
return host_items;
}
};
};
var allHosts = new AllHosts();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment