这是我的CoffeeScript类
class HotsauceQS
err: null
constructor: (@obj, @qUrl) ->
sendMsg: ->
sqs.sendMessage
MessageBody: JSON.stringify(@obj)
QueueUrl: @qURL
, @handleResponse
handleResponse: (err, data) =>
@err = err if err?
module.exports = HotsauceQS
我无法设置@err
属性:
h = require('./hotsaucesqs')
m = new h obj, url
m.sendMsg()
console.log m.err # this is undefined :(