Skip to content

Instantly share code, notes, and snippets.

@orlybg

orlybg/dbdiff.js Secret

Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orlybg/28a82b42ab86a85d96f8 to your computer and use it in GitHub Desktop.
Save orlybg/28a82b42ab86a85d96f8 to your computer and use it in GitHub Desktop.
var DbDiff = (function() {
var foo;
var hostList;
var $hostSelect1;
var $hostSelect2;
function init() {
console.log('-------- INIT --------');
this.foo = 'bar';
this.hostList = ['tuna.letstalk.com', 'foo.bar'];
this.$hostSelect1 = $('#hostSelect1');
this.$hostSelect2 = $('#hostSelect2');
};
function enterHost() {
console.log('----------------------------');
};
function getHostList() {
console.log('hosts1', this.$hosts1 );
return this.hostList;
};
function populateHostList() {
DbDiff = this;
$arrHosts = $('#hostSelect1, #hostSelect2');
$.each($arrHosts, function(idx, host) {
$.each(DbDiff.getHostList(), function(key, value) {
$host = $(host);
$host.append($("<option></option>").attr("value", value).text(value));
});
});
};
return {
init : init,
enterHost : enterHost,
getHostList : getHostList,
populateHostList : populateHostList,
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment