Skip to content

Commit

Permalink
clean up example style
Browse files Browse the repository at this point in the history
  • Loading branch information
jessetane committed Aug 16, 2017
1 parent f1e0f0a commit 7792633
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var q = queue()
var results = []

// add jobs using the familiar Array API

q.push(function (cb) {
results.push('two')
cb()
Expand All @@ -21,7 +20,7 @@ q.push(
}
)

// jobs are functions that accept a callback or return a promise
// jobs can accept a callback or return a promise
q.push(function () {
return new Promise(function (resolve, reject) {
results.push('one')
Expand All @@ -41,7 +40,6 @@ q.splice(2, 0, function (cb) {

// use the timeout feature to deal with jobs that
// take too long or forget to execute a callback

q.timeout = 100

q.on('timeout', function (next, job) {
Expand All @@ -61,13 +59,11 @@ q.push(function (cb) {
})

// get notified when jobs complete

q.on('success', function (result, job) {
console.log('job finished processing:', job.toString().replace(/\n/g, ''))
})

// begin processing, get notified on end / failure

q.start(function (err) {
if (err) throw err
console.log('all done:', results)
Expand Down
6 changes: 1 addition & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var q = queue()
var results = []

// add jobs using the familiar Array API

q.push(function (cb) {
results.push('two')
cb()
Expand All @@ -39,7 +38,7 @@ q.push(
}
)

// jobs are functions that accept a callback or return a promise
// jobs can accept a callback or return a promise
q.push(function () {
return new Promise(function (resolve, reject) {
results.push('one')
Expand All @@ -59,7 +58,6 @@ q.splice(2, 0, function (cb) {

// use the timeout feature to deal with jobs that
// take too long or forget to execute a callback

q.timeout = 100

q.on('timeout', function (next, job) {
Expand All @@ -79,13 +77,11 @@ q.push(function (cb) {
})

// get notified when jobs complete

q.on('success', function (result, job) {
console.log('job finished processing:', job.toString().replace(/\n/g, ''))
})

// begin processing, get notified on end / failure

q.start(function (err) {
if (err) throw err
console.log('all done:', results)
Expand Down

0 comments on commit 7792633

Please sign in to comment.