Skip to content

Commit eade4a8

Browse files
committed
Not always async demo added.
1 parent f4fcd34 commit eade4a8

File tree

9 files changed

+3157
-1
lines changed

9 files changed

+3157
-1
lines changed

07 Timer Gotchas/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,3 @@
8585

8686
* If we change `requestDelay` to `10`, the avarage gets closer to `10ms`. The reason that this is happen is because by default the browser will set a value close to 4 by default.
8787

88-
* El delay lo inicializamos a 0, cuando lo ejecutamos, estamos pidiendo un delay de 0, pero en el avarage llega cerca de los 5 ms. Lo cambiamos a 10 ms. y la media de resultado que nos da es mucho más proxima a 10ms. La razón de que ocurra esto, es que cuando nosotros ponemos 10 ms, el navegador lo va a modificar para que sean 4ms.

08 Not always async/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Challange ¿Cuantos pequeños programas?
2+
* Folder structure:
3+
4+
08 Not Always Async/
5+
├── src/
6+
│ ├── content/
7+
| | ├── site.css
8+
│ ├── js/
9+
| | ├── utils.js
10+
| | ├── main.js
11+
│ ├── index.html
12+
│ └── bootstrap-theme.min.css
13+
├── gulpfile.js
14+
├── package.json
15+
16+
## Steps.
17+
18+
### 1. Open `main.js`.
19+
20+
* Challange -> How many little programs? // 1
21+
* What it's going to be show up on console? // 2, 4, 6
22+
23+
* We can ask ourselves if this function is an async function or not. The fact is that there is no way to know it, without know how `forEach` function is implemented.
24+
25+
* We can wrap the function with `setTimeout`, and we obtain another thing.

08 Not always async/gulpfile.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
const gulp = require('gulp'),
4+
connect = require('gulp-connect'),
5+
open = require('gulp-open'),
6+
options = {
7+
port: 9005,
8+
root: ['src'],
9+
devBase: 'http://localhost:',
10+
browsers: ['safari', 'chrome']
11+
},
12+
openOptions = {
13+
uri: options.devBase + options.port,
14+
app: options.browser
15+
};
16+
17+
gulp.task('connect', () => connect.server({
18+
root: options.root,
19+
port: options.port
20+
}));
21+
// https://github.com/stevelacy/gulp-open/issues/15
22+
gulp.task('open', () => gulp.src(__filename).pipe(open(openOptions)));
23+
24+
gulp.task('default', ['connect', 'open']);

0 commit comments

Comments
 (0)