Set up the connected handler before connect

This commit is contained in:
Raymond Feng 2013-04-15 16:05:17 -07:00
parent 589908a78f
commit 3613f6e22f
1 changed files with 2 additions and 3 deletions

View File

@ -258,13 +258,12 @@ AbstractClass.create = function (data, callback) {
function stillConnecting(schema, obj, args) {
if (schema.connected) return false;
if (!schema.connecting) {
schema.connect();
}
if (schema.connecting) return true;
var method = args.callee;
schema.on('connected', function () {
method.apply(obj, [].slice.call(args));
});
schema.connect();
return true;
};