Inside the standard isClient
conditional I have a variable stored. Let's say I needed to access this from the window
, where would it be located?
if (Meteor.isClient) {
var people = new Meteor.Collection("people");
}
Thanks!
Inside the standard isClient
conditional I have a variable stored. Let's say I needed to access this from the window
, where would it be located?
if (Meteor.isClient) {
var people = new Meteor.Collection("people");
}
Thanks!
In Meteor client environment, every variable you declare without the
var
keyword is accessible on the global object which iswindow
.Variables declared with the
var
keyword are file scoped, variables declared without thevar
keyword are application scoped.On the client, the global scope is the
window
object, on the server, the global scope is theglobal
object.When you declare a global variable in both environments, a property with this name is declared both on the
window
object and theglobal
object, these two properties are distinct, if you modify the client one, it won't impact the server one.