Permalink
Browse files

moving lines around solved the problem of 'ready' never being caught

  • Loading branch information...
1 parent 0404a1a commit c8d5652233ca1539a1b19e0dcf65dec5bf8812f5 @pkrumins committed Oct 14, 2010
Showing with 8 additions and 7 deletions.
  1. +8 −7 lib/store.js
View
@@ -33,13 +33,6 @@ function Store(opts, cb) {
var actionQueue = [];
var ready = false;
- self.on('ready', function () {
- ready = true;
- actionQueue.forEach(function (action) {
- action.action.apply(self, action.args);
- });
- delete actionQueue;
- });
function queue(action, args) {
actionQueue.push({ action : action, args : [].slice.call(args) });
@@ -228,6 +221,14 @@ function Store(opts, cb) {
;
};
+ self.on('ready', function () {
+ ready = true;
+ actionQueue.forEach(function (action) {
+ action.action.apply(self, action.args);
+ });
+ delete actionQueue;
+ });
+
if (openDbs[opts.filename]) {
var db = openDbs[opts.filename];
cb(undefined, db);

0 comments on commit c8d5652

Please sign in to comment.