double-under
Advanced tools
Comparing version 0.0.5 to 0.0.6
17
index.js
@@ -8,2 +8,4 @@ "use strict"; | ||
, randId = require('./lib/rand') | ||
, ready = require('ready') | ||
; | ||
@@ -144,17 +146,14 @@ var EventEmitter = events.EventEmitter | ||
if (!config) throw new Error('You must call __.configure before using double-under'); | ||
// inherits EventEmitter | ||
EventEmitter.call(this); | ||
var self = this; | ||
this.name = name; | ||
this.ready = false; | ||
this.on('newListener', function(event, listener) { | ||
if (event === 'ready' && self.ready) { | ||
listener(); | ||
} | ||
}); | ||
register(this, function() { | ||
self.ready = true; | ||
self.emit("ready"); | ||
self.ready(true); | ||
}); | ||
} | ||
util.inherits(DoubleUnder, EventEmitter); | ||
ready.mixin(DoubleUnder.prototype); | ||
@@ -161,0 +160,0 @@ DoubleUnder.prototype.addSetter = function addSetter(key) { |
@@ -5,3 +5,3 @@ { | ||
"description": "Shared Object", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"repository": "git://github.com/regality/double-under.git", | ||
@@ -12,6 +12,6 @@ "homepage": "https://github.com/regality/double-under", | ||
"redis": "~0.7.1", | ||
"underscore": "~1.3.3" | ||
"underscore": "~1.3.3", | ||
"ready": "0.1.0" | ||
}, | ||
"devDependencies": { | ||
}, | ||
"devDependencies": {}, | ||
"engines": { | ||
@@ -18,0 +18,0 @@ "node": "*" |
@@ -37,2 +37,4 @@ # Double Under | ||
* Add expire option | ||
* Add a test suite. |
@@ -7,3 +7,3 @@ var __ = require('../index'); | ||
x.on('ready', function() { | ||
x.ready(function() { | ||
x.set('arr', []); | ||
@@ -10,0 +10,0 @@ var inc = Number(x.inc); |
@@ -7,5 +7,5 @@ var __ = require('../index'); | ||
x.on("ready", function() { | ||
x.ready(function() { | ||
x.unset('hai'); | ||
process.exit(); | ||
}); |
@@ -7,5 +7,5 @@ var __ = require('../index'); | ||
x.on('ready', function() { | ||
x.ready(function() { | ||
x.set('hai', 'bai'); | ||
process.exit(); | ||
}); |
@@ -7,4 +7,4 @@ var __ = require('../index'); | ||
x.on('ready', function() { | ||
x.on('ready', function() { | ||
x.ready(function() { | ||
x.ready(function() { | ||
x.set('inc', 7); | ||
@@ -11,0 +11,0 @@ process.exit(); |
@@ -24,3 +24,3 @@ var spawn = require('child_process').spawn | ||
x.on('ready', function() { | ||
x.ready(function() { | ||
runFile('inc', function() { | ||
@@ -27,0 +27,0 @@ assert.equal(x.inc, 7); |
40
8113
3
263
+ Addedready@0.1.0
+ Addedready@0.1.0(transitive)