Answer the question
In order to leave comments, you need to log in
Meteor + polymer without blaze?
I am trying to use meteor + polymer without blaze templates.
I wrote this behavior:
MeteorBehavior = {
properties: {
isReady: {
type: Boolean,
value: false,
notify: true
},
currentUser: {
type: Object,
value: null,
notify: true
}
},
ready: function () {
var self = this;
var subCount = 0;
self.subscriptions.forEach(function(itm){
itm = $.type(itm) == 'array' ? itm : [itm];
itm[itm.length] = function () {
subCount++;
self.isReady = subCount >= self.subscriptions.length;
};
Meteor.subscribe.apply(null, itm);
});
Meteor.startup(function () {
Tracker.autorun(function(){
self.currentUser = Meteor.user();
});
Tracker.autorun(self.autorun.bind(self));
});
},
subscriptions: [],
autorun: function() {
}
};
(function () {
Polymer({
is: 'posts-list',
posts: [],
behaviors: [MeteorBehavior],
autorun: function(){
this.posts = Posts.find().fetch();
},
subscriptions: ['posts']
});
})();
Answer the question
In order to leave comments, you need to log in
Here's a tip for you, Antokh:
https://github.com/meteor/meteor/issues/2765 so everything is there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question