Определение переменной в Meteor.js

Когда я определяю переменнуюlists как показано ниже и введитеlists в консоли я получаю ошибкуReferenceError: 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
  });
}

Это работает, только если я заявляюlists как глобальная переменная:

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

Вопрос: Почему он должен быть глобальным?

Ответы на вопрос(1)

Ваш ответ на вопрос