Skip to content

Commit c51cb7a

Browse files
committed
Clarify README language
1 parent a5ef502 commit c51cb7a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Debounce Event
22

3-
Debounces batched browser event callback execution until the last event within a given time period. The utility returns a key upon event/callback attachment which can be later used to attach multiple callbacks to the same debounced event batch by given element, event name, and timeout. Debounced event batches can be manually detached, or will detach automatically if the callback is specified to be executed only once.
3+
Debounces batched browser event callback execution until the last event within a given time period. The utility returns a key upon initial event attachment which can be later used to add multiple callbacks to the same debounced event batch by given element, event name, and timeout. Debounced event batches can be manually detached, or will detach automatically if the callback is specified to be executed only once and there are no other callbacks left in the event batch.
44

55
## Usage
66

@@ -43,12 +43,12 @@ require 'debounce-event'
4343

4444
| Name | Description | Required |
4545
| ---- | ----------- | -------- |
46-
| eventName | Name of the browser event to handle. | if `eventKey` not given |
4746
| elem | DOM element to attach the event handler. | if `eventKey` not given |
47+
| eventName | Name of the browser event to handle. | if `eventKey` not given |
4848
| done | Callback to execute on the debounced event. | always |
49-
| timeout | Timeout (ms) at which to debounce the event before executing the callback. | always |
50-
| once | True if the callback should execute only once. If the event is the only event in its group, its handler will be detached after the callback executes. Default is `false`. | no |
51-
| eventKey | Previously returned key of an event group to add this callback. If this parameter is specified, `eventName` and `elem` are not used since an event group uses a common event handler. | no |
49+
| timeout | Timeout (ms) at which to debounce the event callback. | always |
50+
| once | True if the callback should execute only once. If the callback is the only one in its batch, its handler will be detached after the callback executes. Default is `false`. | no |
51+
| eventKey | Previously returned key of an event batch to add this callback. If this parameter is specified, `eventName` and `elem` are not used since an event batch uses a common event handler. | no |
5252

5353
#### Example
5454

@@ -84,7 +84,7 @@ var eventKey2 = DebounceEvent.attach({
8484
timeout: 300
8585
})
8686

87-
// Manually detach the given event group
87+
// Manually detach the given event batch
8888
DebounceEvent.detach(eventKey2)
8989
```
9090

0 commit comments

Comments
 (0)