Theres是Meteor Windows Release bug?
当我尝试这个时,工作:
//Main File
Persons = {}
Persons.person = {name : "Roger", age : 30}
//Another file
console.log(Persons.person);
但是当我在另一个JS中调用时,比如下面的代码,使用“console.log(”Persons“)”不起作用:
PersonsCollection = new Mongo.Collection("persons");
Meteor.subscribe("allPersons");
// THIS CODE
console.log(Persons);
if (Meteor.isServer) {
PersonsCollection.allow({
insert : function () {
if(Roles.userIsInRole(Meteor.userId(), ['admin'])){
return true;
} else{
return false;
}
},
update : function () {
if(Roles.userIsInRole(Meteor.userId(), ['admin'])){
return true;
} else{
return false;
}
},
remove : function () {
if(Roles.userIsInRole(Meteor.userId(), ['admin'])){
return true;
} else{
return false;
}
}
});
}
结构:
models/personsCollection.js //Bug here
models/test1.js //I have created the global var here
models/test2.js //I called here