Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MeteorJS and Coffeescript

I had /clients/client.js , /server/server.js and /model.js

In model.js I had: "Lists = new Meteor.Collection("lists"); In client/server I had used this collection. All works fine.

After adding coffeescript. I had convert all my js (3) files into .coffee. Remove js files and start meteor. But now I've got:

Uncaught ReferenceError: Lists is not defined

Why? Where is mistake?

Lists = new Meteor.Collection "lists"

Thanks

like image 432
Vladislav Avatar asked Apr 19 '13 09:04

Vladislav


1 Answers

See http://docs.meteor.com/#coffeescript about how to use @ as a convenient way to define global variables from CoffeeScript inside of the Meteor environment. As @Akshat mentioned in the comments, Meteor sets this at the top level to the global environment to make this easy.

like image 185
Andrew Wilcox Avatar answered Nov 08 '22 06:11

Andrew Wilcox