mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
30 lines
887 B
Plaintext
Executable File
30 lines
887 B
Plaintext
Executable File
Coding standards and advice for iD
|
|
==================================
|
|
|
|
Objects
|
|
-------
|
|
|
|
Most of iD is written with [a js module pattern](http://macwright.org/2012/06/04/the-module-pattern.html):
|
|
that is, they do not use the `new` operator, and they use scope instead of
|
|
`this` to reference variables and functions.
|
|
|
|
Function names
|
|
--------------
|
|
Anything that creates and calls an Action should be prefixed with do:
|
|
doSetLatLon(lat,lon)
|
|
|
|
Anything that is called by an Action, to do the actual work, should be prefixed with an underscore:
|
|
_setLatLon(lat,lon)
|
|
|
|
and commented as such. Underscores are also used to prefix private methods.
|
|
|
|
File naming
|
|
-----------
|
|
The filename should be the name of the base class. You can add subclasses within
|
|
that file for clarity. Don't add extra classes that aren't subclasses,
|
|
unless they're not referenced from elsewhere.
|
|
|
|
Layout
|
|
------
|
|
* Soft tabs
|