Set up the connected handler before connect
This commit is contained in:
parent
589908a78f
commit
3613f6e22f
|
@ -258,13 +258,12 @@ AbstractClass.create = function (data, callback) {
|
||||||
|
|
||||||
function stillConnecting(schema, obj, args) {
|
function stillConnecting(schema, obj, args) {
|
||||||
if (schema.connected) return false;
|
if (schema.connected) return false;
|
||||||
if (!schema.connecting) {
|
if (schema.connecting) return true;
|
||||||
schema.connect();
|
|
||||||
}
|
|
||||||
var method = args.callee;
|
var method = args.callee;
|
||||||
schema.on('connected', function () {
|
schema.on('connected', function () {
|
||||||
method.apply(obj, [].slice.call(args));
|
method.apply(obj, [].slice.call(args));
|
||||||
});
|
});
|
||||||
|
schema.connect();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue