react-native-meteor
Advanced tools
Comparing version 1.0.0-rc6 to 1.0.0-rc7
{ | ||
"name": "react-native-meteor", | ||
"version": "1.0.0-rc6", | ||
"version": "1.0.0-rc7", | ||
"description": "Full Meteor Client for React Native", | ||
@@ -5,0 +5,0 @@ "main": "src/Meteor.js", |
@@ -15,8 +15,2 @@ import Trackr from 'trackr'; | ||
} | ||
if(this.startMeteorSubscriptions) { | ||
console.warn('startMeteorSubscriptions is deprecated and will be removed soon. Please create your subscriptions in getMeteorData.'); | ||
this._meteorSubscriptionsManager = new MeteorSubscriptionsManager(this); | ||
this._meteorSubscriptionsManager.getMeteorSubscriptions(); | ||
} | ||
}); | ||
@@ -71,41 +65,2 @@ | ||
class MeteorSubscriptionsManager { | ||
constructor(component) { | ||
this.component = component; | ||
this.computation = null; | ||
this._meteorSubscriptionsDep = new Trackr.Dependency(); | ||
this._meteorDataChangedCallback = ()=>{this._meteorSubscriptionsDep.changed()}; | ||
Data.onChange(this._meteorDataChangedCallback); | ||
} | ||
dispose() { | ||
if (this.computation) { | ||
this.computation.stop(); | ||
this.computation = null; | ||
} | ||
Data.offChange(this._meteorDataChangedCallback); | ||
} | ||
stateOrPropsChanged() { | ||
} | ||
getMeteorSubscriptions() { | ||
this.computation = Trackr.nonreactive(() => { | ||
return Trackr.autorun((c) => { | ||
this._meteorSubscriptionsDep.depend(); | ||
this.component.startMeteorSubscriptions(); | ||
}); | ||
}); | ||
} | ||
} | ||
// A class to keep the state and utility methods needed to manage | ||
@@ -186,3 +141,8 @@ // the Meteor data for a component. | ||
// recalculates getMeteorData() and re-renders the component. | ||
component.forceUpdate(); | ||
try { | ||
component.forceUpdate(); | ||
} catch(e) { | ||
console.error(e); | ||
} | ||
} | ||
@@ -189,0 +149,0 @@ }); |
54397
1284