user468587
user468587

Reputation: 5031

coffee script method is not defined

i have coffee script class that defined a method named 'isOutdated', right it only output some text, i need to use this method in another method, but it always complained 'isOutdated is not defined', don't know why,

here is my code:

class A
  ...
  isOutdated: (last, curr) ->
    'hell..o'

  run: (callback) ->
    @store.findOne config, {name : 'a' }, {}, {}, (err, results) =>
      return callback err, null if err
      callback null, isOutdated 'last', 'curr'

and here is what it complaint: [ReferenceError: isOutdated is not defined]

Upvotes: 0

Views: 493

Answers (1)

mu is too short
mu is too short

Reputation: 434596

If you want to reference the isOutdated method then you need to say

  callback null, @isOutdated 'last', 'curr'
  # -------------^

Just isOutdated is looking for a local variable, not the method.

Upvotes: 1

Related Questions