habitica-self-host/require.js-example/app/module.coffee
yangit ffdf279ee1 Require.js example expanded.
Helpers.js\moment.js included.
Alogos are still BROKEN. I'm deploying them here for testing.
2013-05-15 14:17:53 +08:00

20 lines
No EOL
672 B
CoffeeScript

#This is a boilerplate to make this file both node.js and AMD (require.js) module compatible.
({ define: (
if typeof define == "function"
define
else
(F)->
F(require, exports, module)
)}).define (require, exports, module)->
#Write your code here as usual
#I.e. require parent module
#NOTE: I did not figure out how to require coffee-script here. As this has to be both Node.js and require.js compatible syntax. And they disagree on how to do that. Anyway we can stick with .js parent modules for a while.
parent = require('./parentModule');
module.exports =
{
foo: (message)->
#use parent module
alert parent.parentFoo message
}