radar_client
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -0,1 +1,4 @@ | ||
### 0.11.0 | ||
* Stream resource API added | ||
### 0.10.0 | ||
@@ -2,0 +5,0 @@ * emit message events in a new context to avoid errors |
@@ -178,2 +178,16 @@ (function(){function require(e,t){for(var n=[],r=e.split("/"),i,s,o=0;s=r[o++];)".."==s?n.pop():"."!=s&&n.push(s);n=n.join("/"),o=require,s=o.m[t||0],i=s[n+".js"]||s[n+"/index.js"]||s[n];if(s=i.c)i=o.m[t=s][e=i.m];return i.exports||i(i,i.exports={},function(n){return o("."!=n.charAt(0)?n:e+"/../"+n,t)}),i.exports}; | ||
Client.prototype.stream = function(scope) { | ||
return new Scope('stream:/'+this._configuration.accountName+'/'+scope, this); | ||
}; | ||
Client.prototype.push = function(scope, resource, action, value, callback) { | ||
return this._write({ | ||
op: 'push', | ||
to: scope, | ||
resource: resource, | ||
action: action, | ||
value: value | ||
}, callback); | ||
}; | ||
Client.prototype.set = function(scope, value, callback) { | ||
@@ -197,4 +211,10 @@ return this._write({ | ||
Client.prototype.subscribe = function(scope, callback) { | ||
return this._write({ op: 'subscribe', to: scope }, callback); | ||
Client.prototype.subscribe = function(scope, options, callback) { | ||
var message = { op: 'subscribe', to: scope }; | ||
if (typeof options == 'function') { | ||
callback = options; | ||
} else { | ||
message.options = options; | ||
} | ||
return this._write(message, callback); | ||
}; | ||
@@ -466,3 +486,3 @@ | ||
var props = [ 'set', 'get', 'subscribe', 'unsubscribe', 'publish', 'sync', | ||
var props = [ 'set', 'get', 'subscribe', 'unsubscribe', 'publish', 'push', 'sync', | ||
'on', 'once', 'when', 'removeListener', 'removeAllListeners']; | ||
@@ -469,0 +489,0 @@ |
@@ -138,2 +138,16 @@ /* globals setImmediate */ | ||
Client.prototype.stream = function(scope) { | ||
return new Scope('stream:/'+this._configuration.accountName+'/'+scope, this); | ||
}; | ||
Client.prototype.push = function(scope, resource, action, value, callback) { | ||
return this._write({ | ||
op: 'push', | ||
to: scope, | ||
resource: resource, | ||
action: action, | ||
value: value | ||
}, callback); | ||
}; | ||
Client.prototype.set = function(scope, value, callback) { | ||
@@ -157,4 +171,10 @@ return this._write({ | ||
Client.prototype.subscribe = function(scope, callback) { | ||
return this._write({ op: 'subscribe', to: scope }, callback); | ||
Client.prototype.subscribe = function(scope, options, callback) { | ||
var message = { op: 'subscribe', to: scope }; | ||
if (typeof options == 'function') { | ||
callback = options; | ||
} else { | ||
message.options = options; | ||
} | ||
return this._write(message, callback); | ||
}; | ||
@@ -161,0 +181,0 @@ |
@@ -6,3 +6,3 @@ function Scope(prefix, client) { | ||
var props = [ 'set', 'get', 'subscribe', 'unsubscribe', 'publish', 'sync', | ||
var props = [ 'set', 'get', 'subscribe', 'unsubscribe', 'publish', 'push', 'sync', | ||
'on', 'once', 'when', 'removeListener', 'removeAllListeners']; | ||
@@ -9,0 +9,0 @@ |
{ | ||
"name": "radar_client", | ||
"description": "Realtime apps with a high level API based on engine.io", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"author": "Mikito Takada <mikito.takada@gmail.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
102317
2759