Skip to content

Commit 04ca999

Browse files
committed
Fixed code layout
1 parent 5919a39 commit 04ca999

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

interfaceWrapper/en/README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ this callback, logging callback calls.
2929
This task can be divided into a few steps.
3030
2. Remove `setTimeout` example from `application.js` and replace it with the
3131
following code:
32+
3233
```JavaScript
3334
var fileName = './README.md';
3435
console.log('Application going to read ' + fileName);
@@ -43,6 +44,7 @@ length.
4344
3. Next step is preparing function `cloneInterface(interfaceName)` for cloning
4445
all keys from given library into new interface. So we can pass its result
4546
(cloned `fs`) to sandbox instead of `fs`. Clonning function example:
47+
4648
```JavaScript
4749
function cloneInterface(anInterface) {
4850
var clone = {};
@@ -58,6 +60,7 @@ closure function. Closure `wrapper` is a newly created function with the help
5860
of functional inheritance, so it will see `fnName`, `fn` in its context. Thus
5961
we can pass all arguments from wrapper into original function as you see in
6062
example:
63+
6164
```JavaScript
6265
function wrapFunction(fnName, fn) {
6366
return function wrapper() {
@@ -69,6 +72,7 @@ example:
6972
}
7073
}
7174
```
75+
7276
5. Now should detect do we have `callback` argument as a last argument of
7377
function call, we can do that by `typeof()` comparing to `function`. If we have
7478
`callback`, we need to wrap it too, so pass ours function instead of `callback`
@@ -79,14 +83,14 @@ try to run wrapped code.
7983
we will model a real application random file system access. Then we can collect
8084
some statistics from `framework.js` and print it every 30 seconds. For example,
8185
you can collect following parameters:
82-
  - number of function calls,
83-
  - number of callbacks,
84-
  - average function completion speed,
85-
  - average return rate of callbacks,
86-
  - total amount of data read from the disk,
87-
  - total amount of recorded data,
88-
  - average read and write speed,
89-
  etc.
86+
- number of function calls,
87+
- number of callbacks,
88+
- average function completion speed,
89+
- average return rate of callbacks,
90+
- total amount of data read from the disk,
91+
- total amount of recorded data,
92+
- average read and write speed,
93+
etc.
9094

9195
Save your results to github, we will need it in next labs, for example we can
9296
transfer overriden wrapped calls (fs operations) to another process and another

0 commit comments

Comments
 (0)