-
Notifications
You must be signed in to change notification settings - Fork 1
Style Guide
Proposed style guide in development
Components should be in title case and resemble Classes.
Crafty.c("MyComponent", {
Methods should use camel case.
.myMethod()
Properties should again be camel case.
.myProperty
Private members must have an underscore _
before the name. Only make it private if the user/developer should never invoke it or modify it. Public members can be anything as long as there is no underscore at the beginning.
If the property is to be modified through Crafty Builder, it should be public.
Events should describe the action taking place. The event name should be in title case.
this.trigger("ButtonClicked")
Multiline comments should be at the start of every component detailing the purpose and the start of every public method and property. The multiline comments will be generated into the API. Use Markdown syntax to describe the method, property or component. It should start with /**@
to denote that this should be generated.
Use the following template for documenting:
/**@
* #nameOfThing
* `public ReturnValue nameOfThing(Type arg)`
* **Parameters:**
* `arg`
* : `Type` Description of argument
*
* **Returns:**
* Description of what it returns.
*
* Description of the thing, what it does and why.
*
* ##Use
* [code example of how to use it]
*/
Use single line comments whenever necessary.