If you are using the “exports” object in your RequireJS module definition and happen to also be using CoffeeScript then be careful to either return the exports object at the end of the function or explicitly return nothing from the function by typing “return” on the last line. Like so:
define((require, exports, module) ->
exports.foo = 'bar'
return
)
If you don’t return nothing or the exports object CoffeeScript will compile this:
define((require, exports, module) ->
exports.foo = 'bar'
)
…to the following javascript:
define(function(require, exports, module) {
return exports.foo = 'bar';
});
Where the return value will be the string ‘bar’. This is no good because if you return a value from your module definition function, RequireJs uses it instead of the exports object. So when you come to require your module, you’ll be passed a String, rather than an object with a “foo” property as you’d expect.
Best selection of the day: http://www.almariah.com/top-13-best-sites-to-buy-usa-facebook-accounts-in-11/
Aw, this was a really nice post. Spending some time and actual effort to produce a
very good article… but what can I say… I put things off a lot and don’t
manage to get anything done.
I am genuinely grateful to the owner of this site who has shared this great article at at this place.
I visited multiple web pages except the audio quality for audio
songs existing at this web site is in fact marvelous.
Hello mates its enormous piece of writing regarding tutoringand entirely defined keep it up all the time. skla