I want to write a static helper class in coffeescript. Is this possible?
class:
class Box2DUtility
constructor: () ->
drawWorld: (world, context) ->
using:
Box2DUtility.drawWorld(w,c);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can define class methods by prefixing them with
@:Demo: http://jsfiddle.net/ambiguous/5yPh7/
And if you want your
drawWorldto act like a constructor then you can saynew @like this:Demo: http://jsfiddle.net/ambiguous/bjPds/1/