Skip to content

Commit

Permalink
What is async js
Browse files Browse the repository at this point in the history
  • Loading branch information
shama committed Jan 6, 2016
1 parent fb9e15e commit 7e0e578
Show file tree
Hide file tree
Showing 6 changed files with 5,074 additions and 0 deletions.
15 changes: 15 additions & 0 deletions what-is-async-javascript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# What is Async JavaScript?

> [https://www.youtube.com/watch?v=y8xPMYwQ0U8](https://www.youtube.com/watch?v=y8xPMYwQ0U8)
Install [Node.js](https://nodejs.org/).

Within this folder run the terminal command `npm install` to install the
`devDependencies`.

Run `node index.js` to run the script through the server side.

Then run `npm start` to start up a development server on `http://localhost:9966`
and run the scripts through the client side.

Use the `node-debug` command by installing [node-inspector](https://www.npmjs.com/package/node-inspector)
35 changes: 35 additions & 0 deletions what-is-async-javascript/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
var nets = require('nets')

nets('one.bear', function (err, resp, one) {
console.log(one.toString())
done()
})
nets('two.bear', function (err, resp, two) {
console.log(two.toString())
done()
})
nets('three.bear', function (err, resp, three) {
console.log(three.toString())
done()
})

var count = 0
function done () {
count++
if (count >= 3) {
console.log('All done')
}
}


// var fs = require('fs')
//
// fs.readFile('one.bear', function (err, one) {
// console.log(one)
// })
// fs.readFile('two.bear', function (err, two) {
// console.log(two)
// })
// fs.readFile('three.bear', function (err, three) {
// console.log(three)
// })
1 change: 1 addition & 0 deletions what-is-async-javascript/one.bear
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
one
18 changes: 18 additions & 0 deletions what-is-async-javascript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "what-is-async-javascript",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "budo index.js",
"test": "node test.js"
},
"author": "Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)",
"license": "MIT",
"devDependencies": {
"budo": "^7.1.0"
},
"dependencies": {
"nets": "^3.2.0"
}
}
1 change: 1 addition & 0 deletions what-is-async-javascript/three.bear
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
three
Loading

0 comments on commit 7e0e578

Please sign in to comment.