This commit is contained in:
William Mantly 2016-02-07 00:42:45 -05:00
parent 5df3ecd5af
commit 0c891f62ef

7
lxc.js
View File

@ -186,21 +186,24 @@ Container.prototype.UpdateFromInfo = function(data){
var lxcORM = function(){ var lxcORM = function(){
this.containers = {} this.containers = {}
this.isReady = false;
this.whenReady = [];
this.list(function(data){ this.list(function(data){
for(var idx = data.length; idx--;){ for(var idx = data.length; idx--;){
console.log(data[idx].name) console.log(data[idx].name)
this.containers[data[idx].name] = new Container(data[idx]); this.containers[data[idx].name] = new Container(data[idx]);
} }
}); });
this.isReady = false;
this.whenReady = [];
this.callReady();
}; };
lxcORM.prototype.callReady = function(){ lxcORM.prototype.callReady = function(){
for(var idx=0; idx<this.whenReady.length; idx--){ for(var idx=0; idx<this.whenReady.length; idx--){
this.whenReady[idx].apply(this); this.whenReady[idx].apply(this);
} }
this.isReady = true;
} }
lxcORM.prototype.ready = function(callback){ lxcORM.prototype.ready = function(callback){