Updated Style Guide (markdown)
parent
731e493a52
commit
7321daefce
@ -10,12 +10,14 @@
|
|||||||
|
|
||||||
## Braces
|
## Braces
|
||||||
* No braces for single line control statements
|
* No braces for single line control statements
|
||||||
```
|
|
||||||
|
```javascript
|
||||||
if (someVar)
|
if (someVar)
|
||||||
return true;
|
return true;
|
||||||
```
|
```
|
||||||
* Opening brace on the same line
|
* Opening brace on the same line
|
||||||
```
|
|
||||||
|
```javascript
|
||||||
if (someVar) {
|
if (someVar) {
|
||||||
someVar += 2;
|
someVar += 2;
|
||||||
return someVar;
|
return someVar;
|
||||||
@ -24,20 +26,24 @@ if (someVar) {
|
|||||||
|
|
||||||
## White Space
|
## White Space
|
||||||
* Space after control statements (if, else, while, for, ...)
|
* Space after control statements (if, else, while, for, ...)
|
||||||
```
|
|
||||||
|
```javascript
|
||||||
if (someVar)
|
if (someVar)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Classes
|
## Classes
|
||||||
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.
|
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. Also, note the naming of all anonymous functions.
|
||||||
```
|
|
||||||
|
```javascript
|
||||||
var Name = (function NameClosure() {
|
var Name = (function NameClosure() {
|
||||||
function Name(name) {
|
function Name(name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Name.prototype = {
|
Name.prototype = {
|
||||||
...
|
functionName: function Name_FunctionName(argOne, argTwo) {
|
||||||
|
...
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return Name;
|
return Name;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user