Definiowanie zmiennej w Meteor.js

Kiedy definiuję zmiennąlists jak pokazano poniżej i wpiszlists w konsoli dostaję błądReferenceError: lists is not defined

var lists = new Meteor.Collection('Lists');

if (Meteor.isClient) {
  Template.hello.greeting = function () {
    return "my list.";
  };

  Template.hello.events({
    'click input' : function () {
      // template data, if any, is available in 'this'
      if (typeof console !== 'undefined')
        console.log("You pressed the button");
    }
  });
}

if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup
  });
}

Działa tylko, jeśli oświadczęlists jako zmienna globalna:

lists = new Meteor.Collection('Lists');

Pytanie: Dlaczego musi mieć zasięg globalny?

questionAnswers(1)

yourAnswerToTheQuestion