-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better callbacks + control over timeouts.
- Loading branch information
Showing
3 changed files
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Sequencr.js V3 | ||
Sequencr.js V4 | ||
The MIT License (MIT) | ||
Copyright (c) 2016 Joshua Sideris | [email protected] | https://github.com/JSideris/Sequencr.js | ||
|
@@ -27,12 +27,12 @@ function Sequencr() { | |
Sequencr.for.apply(This, [startInclusive + 1, endExclusive, callback, timeout, onCompleted]); | ||
} | ||
else if(onCompleted) { | ||
onCompleted.call(this); | ||
onCompleted.call(this, false); | ||
} | ||
}, timeout, this); | ||
}, (!!(timeout && timeout.constructor && timeout.call && timeout.apply)) ? (timeout(startInclusive) || 1) : (timeout || 1), this); | ||
} | ||
else if(onCompleted) { | ||
onCompleted.call(this); | ||
onCompleted.call(this, true); | ||
} | ||
} | ||
|
||
|
@@ -42,7 +42,7 @@ function Sequencr() { | |
if(ret !== false){ | ||
Sequencr.do.apply(This, [callback, timeout]); | ||
} | ||
}, timeout, this); | ||
}, (!!(timeout && timeout.constructor && timeout.call && timeout.apply)) ? (timeout() || 1) : (timeout || 1), this); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Sequencr.js V3 | ||
Sequencr.js V4 | ||
The MIT License (MIT) | ||
Copyright (c) 2016 Joshua Sideris | [email protected] | https://github.com/JSideris/Sequencr.js | ||
|
@@ -12,4 +12,4 @@ and to permit persons to whom the Software is furnished to do so, subject to the | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
*/ | ||
|
||
function Sequencr(){this.chain=function(n,t){Sequencr["for"].apply(this,[0,n.length,function(t){n[t].call(this)},t])},this["for"]=function(n,t,c,i,e){t>n?setTimeout(function(u){var l=c.call(u,n);l!==!1?Sequencr["for"].apply(u,[n+1,t,c,i,e]):e&&e.call(this)},i,this):e&&e.call(this)},this["do"]=function(n,t){setTimeout(function(c){var i=n.call(c);i!==!1&&Sequencr["do"].apply(c,[n,t])},t,this)}}var Sequencr=new Sequencr; | ||
function Sequencr(){this.chain=function(c,n){Sequencr["for"].apply(this,[0,c.length,function(n){c[n].call(this)},n])},this["for"]=function(c,n,t,l,i){n>c?setTimeout(function(e){var o=t.call(e,c);o!==!1?Sequencr["for"].apply(e,[c+1,n,t,l,i]):i&&i.call(this,!1)},l&&l.constructor&&l.call&&l.apply?l(c)||1:l||1,this):i&&i.call(this,!0)},this["do"]=function(c,n){setTimeout(function(t){var l=c.call(t);l!==!1&&Sequencr["do"].apply(t,[c,n])},n&&n.constructor&&n.call&&n.apply?n()||1:n||1,this)}}var Sequencr=new Sequencr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters