-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Style Guide
brendandahl edited this page Mar 13, 2012
·
32 revisions
- Indentation - 2 spaces
- Line Length - 80 characters
- variables and functions - lowerCamelCase
- constructor like functions - UpperCamelCase
- constants - ALL_UPPER_CASE_WITH_UNDERSCORES
- No braces for single line control statements
if (someVar)
return true;
- Opening brace on the same line
if (someVar) {
someVar += 2;
return someVar;
}
- Space after control statements (if, else, while, for, ...)
if (someVar)
The standard way of creating classes in pdf.js is the following. Please note that by class we mean an object that is class-like.
var Name = (function NameClosure() {
function Name(name) {
this.name = name;
}
Name.prototype = {
...
};
return Name;
})();