Skip to content

Commit

Permalink
Adding delay option to wait
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabriskie committed May 27, 2016
1 parent 00a3f0e commit 74e09ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ let mockAdapter = (resolve, reject, config) => {
}

class Moxios {
constructor() {
constructor(delay = 100) {
this.stubs = new Tracker()
this.requests = new Tracker()
this.delay = delay
}

/**
Expand Down Expand Up @@ -86,9 +87,10 @@ class Moxios {
* May need to beef this up a bit in the future.
*
* @param {Function} fn The function to execute once waiting is over
* @param {Number} delay How much time in milliseconds to wait
*/
wait(fn) {
setTimeout(fn)
wait(fn, delay = this.delay) {
setTimeout(fn, delay)
}
}

Expand Down

0 comments on commit 74e09ee

Please sign in to comment.