Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating app to meteor 3 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .meteor/.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

kcokxcpr7prq.d8m40e4v6tm2
22 changes: 11 additions & 11 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

[email protected].1
[email protected]
[email protected]
[email protected].0
[email protected].2-beta300.7
[email protected].8-beta300.7
[email protected].8-beta300.7
[email protected].2-beta300.7
blaze-html-templates
mongo@1.12.0
[email protected].0
standard-minifier-css@1.7.3
standard-minifier-js@2.6.1
shell-server@0.5.0
[email protected].1
mongo@2.0.0-beta300.7
[email protected].2-beta300.7
standard-minifier-css@1.9.3-beta300.7
standard-minifier-js@3.0.0-beta300.7
shell-server@0.6.0-beta300.7
[email protected].4-beta300.7
jquery
ecmascript@0.15.2
ecmascript@0.16.8-beta300.7
blaze
2 changes: 1 addition & 1 deletion .meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
METEOR@2.3.2
METEOR@3.0-beta.7
152 changes: 77 additions & 75 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -1,76 +1,78 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
logging@1.2.0
meteor@1.9.3
[email protected].1
minifier-css@1.5.4
minifier-js@2.6.1
minimongo@1.7.0
[email protected].5
modules@0.16.0
modules-runtime@0.12.0
mongo@1.12.0
[email protected].2
[email protected].0
[email protected].8
npm-mongo@3.9.0
observe-sequence@1.0.19
ordered-dict@1.1.0
promise@0.12.0
[email protected].0
react-fast-refresh@0.1.1
[email protected].0
[email protected].11
[email protected].1
[email protected].0
[email protected].1
[email protected].0
shell-server@0.5.0
socket-stream-client@0.4.0
spacebars@1.2.0
spacebars-compiler@1.3.0
standard-minifier-css@1.7.3
standard-minifier-js@2.6.1
[email protected].1
templating-compiler@1.4.1
templating-runtime@1.5.0
templating-tools@1.2.1
tracker@1.2.0
[email protected]
[email protected].10
webapp@1.11.1
[email protected].0
logging@1.3.3-beta300.7
meteor@2.0.0-beta300.7
[email protected].2-beta300.7
minifier-css@2.0.0-beta300.7
minifier-js@3.0.0-beta300.7
minimongo@2.0.0-beta300.7
[email protected].10-beta300.7
modules@0.19.1-beta300.7
modules-runtime@0.13.2-beta300.7
mongo@2.0.0-beta300.7
[email protected].4-beta300.7
[email protected].1-beta300.7
[email protected].9-beta300.7
npm-mongo@4.16.1-beta300.7
observe-sequence@2.0.0-alpha300.17
ordered-dict@1.2.0-beta300.7
promise@1.0.0-beta300.7
[email protected].2-beta300.7
react-fast-refresh@0.2.8-beta300.7
[email protected].2-beta300.7
[email protected].13-beta300.7
[email protected].2-beta300.7
[email protected].1-beta300.7
[email protected].2-beta300.7
[email protected].2-beta300.7
shell-server@0.6.0-beta300.7
socket-stream-client@0.5.2-beta300.7
[email protected].0-alpha300.17
spacebars-compiler@2.0.0-alpha300.17
standard-minifier-css@1.9.3-beta300.7
standard-minifier-js@3.0.0-beta300.7
[email protected].4-alpha300.13
templating-compiler@2.0.0-alpha300.17
templating-runtime@2.0.0-alpha300.17
templating-tools@2.0.0-alpha300.17
tracker@1.3.3-beta300.7
[email protected]
[email protected].14-beta300.7
webapp@2.0.0-beta300.7
[email protected].2-beta300.7
44 changes: 26 additions & 18 deletions leaderboard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { Meteor } from "meteor/meteor";
import { Template } from "meteor/templating";
import { Mongo } from "meteor/mongo";
import { Session } from "meteor/session";
Expand All @@ -17,40 +17,48 @@ if (Meteor.isClient) {
selectedName: function () {
const player = Players.findOne(Session.get("selectedPlayer"));
return player && player.name;
}
},
});

Template.leaderboard.events({
'click .inc': function () {
Players.update(Session.get("selectedPlayer"), {$inc: {score: 5}});
}
"click .inc": function () {
Players.update(Session.get("selectedPlayer"), { $inc: { score: 5 } });
},
});

Template.player.helpers({
selected: function () {
return Session.equals("selectedPlayer", this._id) ? "selected" : '';
}
return Session.equals("selectedPlayer", this._id) ? "selected" : "";
},
});

Template.player.events({
'click': function () {
click: function () {
Session.set("selectedPlayer", this._id);
}
},
});
}

// On server startup, create some players if the database is empty.
if (Meteor.isServer) {
Meteor.startup(function () {
if (Players.find().count() === 0) {
const names = ["Ada Lovelace", "Grace Hopper", "Marie Curie",
"Carl Friedrich Gauss", "Nikola Tesla", "Claude Shannon"];
names.forEach(function (name) {
Players.insert({
name: name,
score: Math.floor(Random.fraction() * 10) * 5
Meteor.startup(async () => {
const names = [
"Ada Lovelace",
"Grace Hopper",
"Marie Curie",
"Carl Friedrich Gauss",
"Nikola Tesla",
"Claude Shannon",
];

const playerCount = await Players.find().countAsync();
if (playerCount === 0) {
for (const name of names) {
await Players.insertAsync({
name,
score: Math.floor(Random.fraction() * 10) * 5,
});
});
}
}
});
}