react-native-meteor
Advanced tools
Comparing version 0.3.2 to 0.5.0
17
index.js
@@ -5,2 +5,4 @@ var DDP = require("ddp.js"); | ||
var endpointSaved = null; | ||
var ddp; | ||
@@ -22,2 +24,5 @@ var subscriptions = []; | ||
on: queue.on, | ||
getUrl: function () { | ||
return endpointSaved.substring(0, endpointSaved.indexOf('/websocket')); | ||
}, | ||
logout: function (callback) { | ||
@@ -61,3 +66,3 @@ logoutCb = callback; | ||
}, | ||
unsuscribe: function (id) { | ||
unsubscribe: function (id) { | ||
ddp.unsub(id); | ||
@@ -71,3 +76,3 @@ subscriptions = subscriptions.map(function (sub) { | ||
}, | ||
suscribe: function (name, collectionName, params, callback) { | ||
subscribe: function (name, collectionName, params, callback) { | ||
if(typeof collectionName != 'string') { | ||
@@ -96,3 +101,3 @@ callback = params; | ||
}, | ||
itemSuscribe: function (name, collectionName, id, callback) { | ||
itemSubscribe: function (name, collectionName, id, callback) { | ||
if(typeof callback == 'undefined') { | ||
@@ -116,3 +121,3 @@ callback = id; | ||
}, | ||
itemUnsuscribe: function (name, collectionName, subId) { | ||
itemUnsubscribe: function (name, collectionName, subId) { | ||
if(typeof subId == 'undefined') { | ||
@@ -131,3 +136,3 @@ subId = collectionName; | ||
disconnect: function () { | ||
//ddp.disconnect(); | ||
ddp.disconnect(); | ||
}, | ||
@@ -141,2 +146,3 @@ reconnect: function () { | ||
connect: function (endpoint) { | ||
endpointSaved = endpoint; | ||
ddp = new DDP({ | ||
@@ -146,2 +152,3 @@ endpoint: endpoint, | ||
}); | ||
ddp.on('connected', function () { | ||
@@ -148,0 +155,0 @@ queue.emit('connected'); |
{ | ||
"name": "react-native-meteor", | ||
"version": "0.3.2", | ||
"version": "0.5.0", | ||
"description": "DDP React-native Client", | ||
@@ -29,7 +29,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"ddp.js": "1.1.0" | ||
"ddp.js": "2.0.1" | ||
}, | ||
"peerDependencies": { | ||
"react-native": ">=0.5 || 0.17.0-rc || 0.18.0-rc || 0.19.0-rc || 0.20.0-rc" | ||
"react-native": ">=0.5 || 0.17.0-rc || 0.18.0-rc || 0.19.0-rc || 0.20.0-rc || 0.21.0-rc || 0.22.0-rc || 0.23.0-rc || 0.24.0-rc" | ||
} | ||
} |
@@ -51,3 +51,3 @@ [](https://badge.fury.io/gh/inProgress-team%2Freact-native-meteor) | ||
this.tasksSub = meteor.suscribe('tasks', function (tasks) { | ||
this.tasksSub = meteor.subscribe('tasks', function (tasks) { | ||
self.setState({ | ||
@@ -60,3 +60,3 @@ dataSource: self.state.dataSource.cloneWithRows(tasks), | ||
componentWillUnmount: function () { | ||
meteor.unsuscribe(this.tasksSub); | ||
meteor.unsubscribe(this.tasksSub); | ||
} | ||
@@ -76,4 +76,9 @@ }); | ||
### suscribe(name, collectionName, params, callback) | ||
### disconnect() | ||
Disconnect from the ddp server. | ||
### subscribe(name, collectionName, params, callback) | ||
Subscribes to a server publication. | ||
@@ -85,3 +90,3 @@ | ||
- `collectionName` **string** *optional* : name of the collection you suscribe (in case the subscription name is different than collection name) | ||
- `collectionName` **string** *optional* : name of the collection you subscribe (in case the subscription name is different than collection name) | ||
@@ -92,3 +97,3 @@ - `params` **array** *optional* : parameters to pass to the server publish function. | ||
### unsuscribe(id) | ||
### unsubscribe(id) | ||
@@ -101,5 +106,5 @@ Unsubscribes to a server publication. | ||
### itemSuscribe(name, collectionName, id, callback) | ||
### itemSubscribe(name, collectionName, id, callback) | ||
Subscribes to an item in a collection (the collection need to be suscribed with same name and collection name parameter). Returns the subscriptionId. | ||
Subscribes to an item in a collection (the collection need to be subscribed with same name and collection name parameter). Returns the subscriptionId. | ||
@@ -110,5 +115,5 @@ #### Arguments | ||
- `collectionName` **string** *optional* : name of the collection you suscribe (in case the subscription name is different than collection name) | ||
- `collectionName` **string** *optional* : name of the collection you subscribe (in case the subscription name is different than collection name) | ||
- `id` **array** *required* : id of the item to suscribe to | ||
- `id` **array** *required* : id of the item to subscribe to | ||
@@ -125,3 +130,3 @@ - `callback` **function** *required* : callback called when there is a change to the item. Returns the element. | ||
- `collectionName` **string** *optional* : name of the collection you suscribe (in case the subscription name is different than collection name) | ||
- `collectionName` **string** *optional* : name of the collection you subscribe (in case the subscription name is different than collection name) | ||
@@ -128,0 +133,0 @@ - `subId` **string** *required* : id of the subscription |
15217
273
185
+ Addedddp.js@2.0.1(transitive)
- Removedddp.js@1.1.0(transitive)
Updatedddp.js@2.0.1