Permalink
Browse files

Demonstrate the order that posts appear using a sleep.

sidebar7-5-1
  • Loading branch information...
tmeasday committed Apr 11, 2013
1 parent 3f25a2a commit b37cae1882a91fa578a35545709d254472d31110
Showing with 11 additions and 3 deletions.
  1. +2 −2 client/templates/posts/post_submit.js
  2. +9 −1 lib/collections/posts.js
@@ -15,8 +15,8 @@ Template.postSubmit.events({
// show this result but route anyway
if (result.postExists)
alert('This link has already been posted');
-
- Router.go('postPage', {_id: result._id});
});
+
+ Router.go('postsList');
}
});
View
@@ -7,7 +7,15 @@ Meteor.methods({
title: String,
url: String
});
-
+
+ if (Meteor.isServer) {
+ postAttributes.title += "(server)";
+ // wait for 5 seconds
+ Meteor._sleepForMs(5000);
+ } else {
+ postAttributes.title += "(client)";
+ }
+
var postWithSameLink = Posts.findOne({url: postAttributes.url});
if (postWithSameLink) {
return {

0 comments on commit b37cae1

Please sign in to comment.