Skip to content

Commit a2a03b7

Browse files
author
AJ ONeal
committed
corrected readme
1 parent 9149de6 commit a2a03b7

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

README.md

+12-13
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,31 @@ Or build with pakmanager:
3939
pakmanager build lateral
4040
```
4141

42-
Standalone Usage
42+
Usage
4343
---
4444

4545
```javascript
4646
;(function () {
4747
'use strict';
4848

49-
var Lateral = require('lateral').Lateral
49+
var Lateral = window.Lateral || require('lateral').Lateral
5050
, maxCallsAtOnce = 4 // default
5151
, lateral
5252
;
5353

54-
lateral = Lateral.create(function (complete, item, i) {
54+
function onEach(complete, item, i) {
5555
setTimeout(function () {
5656
console.log(item);
5757
complete();
5858
}, 500);
59-
}, maxCallsAtOnce);
59+
}
6060

61-
lateral.add(['a', 'b', 'c', 'd']).when(function () {
62-
console.log('did all the things');
63-
});
61+
lateral = Lateral.create(onEach, maxCallsAtOnce);
6462

65-
lateral.add(['d', 'e', 'f', 'g']).when(function () {
63+
lateral.add(['a', 'b', 'c', 'd']);
64+
lateral.add(['d', 'e', 'f', 'g']);
65+
66+
lateral.then(function () {
6667
console.log('did all the things');
6768
});
6869
}());
@@ -75,10 +76,8 @@ Creates a Sequence-ish object for the purpose of synchronizing other Futures.
7576

7677
**Core**
7778

78-
* `lateral = Lateral.create(handler, n)`
79+
* `lateral = Lateral.create(fn, n)`
7980
* create a Lateral that will execute `fn` on each item to do at most `n` things at once
80-
8181
* `lateral.add(arr)` - adds `arr` to be handled by `fn`
82-
83-
* `lateral.add(arr).when(callback)`
84-
* Fires `callback` when all items in the `arr` batch have been handled
82+
* `lateral.then(callback)`
83+
* Fires `callback` when all items in the `arr` have been handled

0 commit comments

Comments
 (0)