Jules
Jules

Reputation: 153

Meteor 0.6.4.1 changes confuses coffeescript?

After upgrading from Meteor 0.5.4 to Meteor 0.6.4.1 I modified my coffeescript code accordingly to reflect changes of the variable scope. For some reason I think the changes confused the coffeescript to javascript interpretation?

Current code:

@liveObjects = {}
test = () ->
if liveObjects.intervalID?
  donothing;
liveObjects = {} --Maybe this is what caused the confusion? Mistaken as a local variable declaration?

From the Chrome tool I noticed that the javascript code as

(function() { var test;
this.liveObjects = {};

test = function() {
  var liveObjects;
  if (liveObjects.intervalID != null) {  --ReferenceError: liveObjects is not defined
    donothing;
  }
  liveOjects = {}; 

Upvotes: 0

Views: 68

Answers (1)

Suburbio
Suburbio

Reputation: 604

You have to set it using this/@ again.

@liveObjects = {}
test = () ->
if liveObjects.intervalID?
  donothing;
@liveObjects = {}

Upvotes: 1

Related Questions