Skip to content

Commit

Permalink
autopublish in leaderboard
Browse files Browse the repository at this point in the history
  • Loading branch information
debergalis committed Feb 29, 2012
1 parent bc05e41 commit cb14d11
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions examples/leaderboard-remote/client/leaderboard-remote.js
Expand Up @@ -3,8 +3,6 @@ Leaderboard = Meteor.connect("http://leader2.meteor.com/sockjs");
// XXX I'd rather this be Leaderboard.Players.. can this API be easier?
Players = new Meteor.Collection("players", Leaderboard);

Leaderboard.subscribe("top10");

Template.main.events = {
'keydown': function () {
Session.set("error", null);
Expand Down
1 change: 1 addition & 0 deletions examples/leaderboard/.meteor/packages
Expand Up @@ -4,3 +4,4 @@
# but you can also edit it by hand.

jquery
autopublish
8 changes: 0 additions & 8 deletions examples/leaderboard/leaderboard.js
Expand Up @@ -5,9 +5,6 @@ Players = new Meteor.Collection("players");
/*** Client ***/

if (Meteor.is_client) {
// Get the top 10 players from the server, updated continuously.
Meteor.subscribe("top10");

$(document).ready(function () {
// List the players by score. You can click to select a player.
var scores = Meteor.ui.renderList(Players.find({}, {sort: {score: -1}}), {
Expand Down Expand Up @@ -54,11 +51,6 @@ if (Meteor.is_client) {
// subdirectory named 'server'.

if (Meteor.is_server) {
// Publish the top 10 players, live, to any client that wants them.
Meteor.publish("top10", {collection: Players,
sort: {score: -1},
limit: 10});

// On server startup, create some players if the database is empty.
Meteor.startup(function () {
if (Players.find().count() === 0) {
Expand Down

0 comments on commit cb14d11

Please sign in to comment.