Updated Style Guide (markdown)
parent
bb521d452c
commit
4baebc9213
@ -45,7 +45,7 @@ if (someVar === conditionA) {
|
|||||||
Variables must be defined only once within a function scope, preferably at the top of the function.
|
Variables must be defined only once within a function scope, preferably at the top of the function.
|
||||||
|
|
||||||
## Classes
|
## Classes
|
||||||
The standard way of creating classes in PDF.js, when adding *new* code, is the following. Please note that by class we mean an object that is class-like.
|
The transition towards ES6 classes has started, but until that is completed, the standard way of creating classes in PDF.js, when adding *new* code, is the following. Please note that by class we mean an object that is class-like.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var ClassName = (function ClassNameClosure() {
|
var ClassName = (function ClassNameClosure() {
|
||||||
@ -54,13 +54,13 @@ var ClassName = (function ClassNameClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClassName.prototype = {
|
ClassName.prototype = {
|
||||||
functionName(arg1, arg2, ...) {
|
functionName: function(arg1, arg2, ...) {
|
||||||
...
|
...
|
||||||
},
|
},
|
||||||
|
|
||||||
anVeryVeryVeryLongFunctionName(arg1,
|
aVeryVeryVeryLongFunctionName(arg1,
|
||||||
arg2,
|
arg2,
|
||||||
...) {
|
...) {
|
||||||
...
|
...
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user