|
@@ -0,0 +1,24 @@
|
|
|
|
+// Fonction hypothétique...
|
|
|
|
+function getFacebookLikeCount() {}
|
|
|
|
+
|
|
|
|
+currentLikeCount = 0;
|
|
|
|
+
|
|
|
|
+Meteor.setInterval(function () {
|
|
|
|
+ var postId;
|
|
|
|
+
|
|
|
|
+ if (Meteor.user() && postId === Session.get('currentPostId')) {
|
|
|
|
+ getFacebookLikeCount(Meteor.user(), Posts.find(postId).url, function (err, count) {
|
|
|
|
+ if (!err) {
|
|
|
|
+ currentLikeCount = count;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+}, 5 * 1000);
|
|
|
|
+
|
|
|
|
+// Insert in "post_item.js".
|
|
|
|
+Template.postItem.helpers({
|
|
|
|
+ likeCount: function () {
|
|
|
|
+ return currentLikeCount;
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|