Created
May 17, 2012 06:02
-
-
Save tmeasday/2716855 to your computer and use it in GitHub Desktop.
Template code that triggers meteor #142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>Sport Grid</title> | |
</head> | |
<body> | |
{{> screens }} | |
</body> | |
<template name="screens"> | |
<div class="container {{ visible_page }}"> | |
<h1>Showing page: {{ visible_page }}</h1> | |
{{> home }} | |
{{> teams }} | |
</div> | |
</template> | |
<template name="home"> | |
<div class="home"> | |
<form class="create_team"> | |
<input name="team[name]" placeholder="Your team name"></input> | |
</form> | |
</div> | |
</template> | |
<template name="teams"> | |
<div class="teams"> | |
{{> team_builder }} | |
</div> | |
</template> | |
<template name="team_builder"> | |
<form class="team_builder"> | |
<input name="team[name]" placeholder="Team name"></input> | |
</form> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Meteor.is_client) { | |
Session.set('visible_page', 'first'); | |
Template.screens.visible_page = function() { return Session.get('visible_page') || 'home'; } | |
Meteor.startup(function() { | |
setTimeout(function() { | |
Session.set('visible_page', 'second') | |
}, 500); | |
setTimeout(function() { | |
Session.set('visible_page', 'third') | |
}, 1000); | |
}) | |
} |
Thanks for the tip! I'll remember that.. My original code didn't use timeouts however, I was just trying to simulate the behaviour of the Facebook API I was using.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I don't know if this has anything to with the error, but I happened to notice. The Meteor documentation on timers discourages the use of JavaScript's native
setTimeout
.It is suggested you use
Meteor.setTimeout
instead.