Optimized subscriptions

This commit is contained in:
Senad Uka
2016-03-06 09:20:36 +01:00
parent 6ea9933d60
commit 357acd6f91
6 changed files with 30 additions and 13 deletions

View File

@@ -9,5 +9,5 @@
#bucket_image {
width: 30%;
width: 60%;
}

8
app/client/startup.js Normal file
View File

@@ -0,0 +1,8 @@
Tracker.autorun(function () {
var id = Session.get('controller_id');
if (id) {
Meteor.subscribe("sensor_data", id);
var hamo = Meteor.subscribe("controller_state", id);
console.log(hamo);
}
});

View File

@@ -1,12 +1,7 @@
function controller_state() {
var controller = Session.get('controller_id');
var result = {}
if (controller) {
result = ControllerState.findOne({
controller_id: controller
});
}
var controllerId = Session.get('controller_id');
result = ControllerState.findOne({});
console.log("jupiii", result);
if (!result) {
result = {}
};