Last active
August 29, 2015 14:26
-
-
Save djfrsn/ae193359c4ce9a2bde54 to your computer and use it in GitHub Desktop.
Meteor Template Level Subscriptions
This file contains hidden or 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
| <template name="dashboardSlideOut"> | |
| {{> accountsBreadcrumb}} | |
| {{#if Template.subscriptionsReady}} | |
| <ul class="collection"> | |
| {{#each libSections}} | |
| <li class="collection-item">{{ libSection }} | |
| <i class="material-icons">heart</i> | |
| </li> | |
| {{/each}} | |
| </ul> | |
| {{else}} | |
| <div class="loading"> | |
| {{#if slow}} | |
| <div class="progress"> | |
| <div class="indeterminate"></div> | |
| </div> | |
| {{/if}} | |
| </div> | |
| {{/if}} | |
| </template> |
This file contains hidden or 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
| // Template.dashboardSlideOut.events = { | |
| // "click .link": buttonCollapse = function ( e, t ) { | |
| // } | |
| // }; | |
| Template.dashboardSlideOut.onCreated(function() { | |
| var instance = this; | |
| instance.slow = new ReactiveVar(false); | |
| // Subscription | |
| instance.subscribe('lib'); | |
| // Cursor | |
| instance.LibSections = function() { | |
| return LibSections.find({}); | |
| } | |
| }); | |
| Template.dashboardSlideOut.onRendered(function() { | |
| }); | |
| // Template.dashboardSlideOut.onDestroyed(function() { | |
| // }); | |
| Template.dashboardSlideOut.helpers({ | |
| libSections: function() { | |
| return Template.instance().LibSections(); | |
| }, | |
| slow: function() { | |
| var instance = Template.instance(); | |
| slow = instance.slow.get(); | |
| Meteor.setTimeout(function() { | |
| instance.slow.set(true); | |
| }, 200); | |
| console.log("slow", slow); | |
| return slow; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment