Skip to content

Commit 7e0e578

Browse files
committed
What is async js
1 parent fb9e15e commit 7e0e578

File tree

6 files changed

+5074
-0
lines changed

6 files changed

+5074
-0
lines changed

what-is-async-javascript/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# What is Async JavaScript?
2+
3+
> [https://www.youtube.com/watch?v=y8xPMYwQ0U8](https://www.youtube.com/watch?v=y8xPMYwQ0U8)
4+
5+
Install [Node.js](https://nodejs.org/).
6+
7+
Within this folder run the terminal command `npm install` to install the
8+
`devDependencies`.
9+
10+
Run `node index.js` to run the script through the server side.
11+
12+
Then run `npm start` to start up a development server on `http://localhost:9966`
13+
and run the scripts through the client side.
14+
15+
Use the `node-debug` command by installing [node-inspector](https://www.npmjs.com/package/node-inspector)

what-is-async-javascript/index.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var nets = require('nets')
2+
3+
nets('one.bear', function (err, resp, one) {
4+
console.log(one.toString())
5+
done()
6+
})
7+
nets('two.bear', function (err, resp, two) {
8+
console.log(two.toString())
9+
done()
10+
})
11+
nets('three.bear', function (err, resp, three) {
12+
console.log(three.toString())
13+
done()
14+
})
15+
16+
var count = 0
17+
function done () {
18+
count++
19+
if (count >= 3) {
20+
console.log('All done')
21+
}
22+
}
23+
24+
25+
// var fs = require('fs')
26+
//
27+
// fs.readFile('one.bear', function (err, one) {
28+
// console.log(one)
29+
// })
30+
// fs.readFile('two.bear', function (err, two) {
31+
// console.log(two)
32+
// })
33+
// fs.readFile('three.bear', function (err, three) {
34+
// console.log(three)
35+
// })

what-is-async-javascript/one.bear

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
one

what-is-async-javascript/package.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "what-is-async-javascript",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "budo index.js",
8+
"test": "node test.js"
9+
},
10+
"author": "Kyle Robinson Young <[email protected]> (http://dontkry.com)",
11+
"license": "MIT",
12+
"devDependencies": {
13+
"budo": "^7.1.0"
14+
},
15+
"dependencies": {
16+
"nets": "^3.2.0"
17+
}
18+
}

what-is-async-javascript/three.bear

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
three

0 commit comments

Comments
 (0)