-
Notifications
You must be signed in to change notification settings - Fork 5
/
debounce.html
492 lines (471 loc) · 35.2 KB
/
debounce.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var _speedMark = new Date();
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="keyworkds" content="lodash文档,lodash中文,lodash中文文档,Lodash,Lodashjs,underscore,underscorejs,javascript,lib,module">
<meta name="description" content="lodash 是一个 JavaScript 的实用工具库, 表现一致性, 模块化, 高性能, 以及 可扩展"/>
<!-- html generated by pub-server from markdown /lodash-zh.js -->
<title>lodash中文文档 debounce</title>
<link rel="icon" href="./images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="./css/prism.css">
<link rel="stylesheet" href="./css/font-awesome.css">
<link rel="stylesheet" href="./css/doc.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- 统计 -->
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=53829628" charset="UTF-8"></script>
</head>
<body>
<div data-render-layout="main-layout"><nav id="nav" onclick=""><span class="fa fa-2x"></span>
<header>
<a href="./" title="lodash"><img src="./images/logo.png" alt="lodash">v4.5.0正式版</a>
</header>
<div id="search">
<form id="search-form" action="./" method="GET">
<input type="search" name="q" id="q" placeholder="搜索内容.." autocomplete="off">
<ul id="q-list" class="shadow"></ul>
</form>
</div>
<div id="toc">
<div id="tochead"><a href="./">主页</a></div>
<ul>
<li id="page-tree" class="folder">
<ul>
<li><a href="./getting-started" title="Getting Started">Getting Started</a></li>
<li><a href="./custom-builds" title="Custom Builds">Custom Builds</a></li>
<li><a href="./all" title="All-in-one Doc">All-in-one Doc</a></li>
</ul></li>
<li id="page-tree-array" class="folder"><span class="folderPage">Array</span>
<ul>
<li><a href="./chunk" title="_.chunk(array, [size=0])">chunk</a></li>
<li><a href="./compact" title="_.compact(array)">compact</a></li>
<li><a href="./concat" title="_.concat(array, [values])">concat</a></li>
<li><a href="./difference" title="_.difference(array, [values])">difference</a></li>
<li><a href="./differenceBy" title="_.differenceBy(array, [values], [iteratee=_.identity])">differenceBy</a></li>
<li><a href="./differenceWith" title="_.differenceWith(array, [values], [comparator])">differenceWith</a></li>
<li><a href="./drop" title="_.drop(array, [n=1])">drop</a></li>
<li><a href="./dropRight" title="_.dropRight(array, [n=1])">dropRight</a></li>
<li><a href="./dropRightWhile" title="_.dropRightWhile(array, [predicate=_.identity])">dropRightWhile</a></li>
<li><a href="./dropWhile" title="_.dropWhile(array, [predicate=_.identity])">dropWhile</a></li>
<li><a href="./fill" title="_.fill(array, value, [start=0], [end=array.length])">fill</a></li>
<li><a href="./findIndex" title="_.findIndex(array, [predicate=_.identity])">findIndex</a></li>
<li><a href="./findLastIndex" title="_.findLastIndex(array, [predicate=_.identity])">findLastIndex</a></li>
<li><a href="./flatten" title="_.flatten(array)">flatten</a></li>
<li><a href="./flattenDeep" title="_.flattenDeep(array)">flattenDeep</a></li>
<li><a href="./flattenDepth" title="_.flattenDepth(array, [depth=1])">flattenDepth</a></li>
<li><a href="./fromPairs" title="_.fromPairs(pairs)">fromPairs</a></li>
<li><a href="./head" title="_.head(array)">head <span class="aliases">first</span></a></li>
<li><a href="./indexOf" title="_.indexOf(array, value, [fromIndex=0])">indexOf</a></li>
<li><a href="./initial" title="_.initial()">initial</a></li>
<li><a href="./intersection" title="_.intersection([arrays])">intersection</a></li>
<li><a href="./intersectionBy" title="_.intersectionBy([arrays], [iteratee=_.identity])">intersectionBy</a></li>
<li><a href="./intersectionWith" title="_.intersectionWith([arrays], [comparator])">intersectionWith</a></li>
<li><a href="./join" title="_.join(array, [separator=','])">join</a></li>
<li><a href="./last" title="_.last(array)">last</a></li>
<li><a href="./lastIndexOf" title="_.lastIndexOf(array, value, [fromIndex=array.length-1])">lastIndexOf</a></li>
<li><a href="./prototype-reverse" title="_.prototype.reverse()">prototype.reverse</a></li>
<li><a href="./pull" title="_.pull(array, [values])">pull</a></li>
<li><a href="./pullAll" title="_.pullAll(array, values)">pullAll</a></li>
<li><a href="./pullAllBy" title="_.pullAllBy(array, values, [iteratee=_.identity])">pullAllBy</a></li>
<li><a href="./pullAt" title="_.pullAt(array, [indexes])">pullAt</a></li>
<li><a href="./remove" title="_.remove(array, [predicate=_.identity])">remove</a></li>
<li><a href="./slice" title="_.slice(array, [start=0], [end=array.length])">slice</a></li>
<li><a href="./sortedIndex" title="_.sortedIndex(array, value)">sortedIndex</a></li>
<li><a href="./sortedIndexBy" title="_.sortedIndexBy(array, value, [iteratee=_.identity])">sortedIndexBy</a></li>
<li><a href="./sortedIndexOf" title="_.sortedIndexOf(array, value)">sortedIndexOf</a></li>
<li><a href="./sortedLastIndex" title="_.sortedLastIndex(array, value)">sortedLastIndex</a></li>
<li><a href="./sortedLastIndexBy" title="_.sortedLastIndexBy(array, value, [iteratee=_.identity])">sortedLastIndexBy</a></li>
<li><a href="./sortedLastIndexOf" title="_.sortedLastIndexOf(array, value)">sortedLastIndexOf</a></li>
<li><a href="./sortedUniq" title="_.sortedUniq(array)">sortedUniq</a></li>
<li><a href="./sortedUniqBy" title="_.sortedUniqBy(array, [iteratee])">sortedUniqBy</a></li>
<li><a href="./tail" title="_.tail(array)">tail</a></li>
<li><a href="./take" title="_.take(array, [n=1])">take</a></li>
<li><a href="./takeRight" title="_.takeRight(array, [n=1])">takeRight</a></li>
<li><a href="./takeRightWhile" title="_.takeRightWhile(array, [predicate=_.identity])">takeRightWhile</a></li>
<li><a href="./takeWhile" title="_.takeWhile(array, [predicate=_.identity])">takeWhile</a></li>
<li><a href="./union" title="_.union([arrays])">union</a></li>
<li><a href="./unionBy" title="_.unionBy([arrays], [iteratee=_.identity])">unionBy</a></li>
<li><a href="./unionWith" title="_.unionWith([arrays], [comparator])">unionWith</a></li>
<li><a href="./uniq" title="_.uniq(array)">uniq</a></li>
<li><a href="./uniqBy" title="_.uniqBy(array, [iteratee=_.identity])">uniqBy</a></li>
<li><a href="./uniqWith" title="_.uniqWith(array, [comparator])">uniqWith</a></li>
<li><a href="./unzip" title="_.unzip(array)">unzip</a></li>
<li><a href="./unzipWith" title="_.unzipWith(array, [iteratee=_.identity])">unzipWith</a></li>
<li><a href="./without" title="_.without(array, [values])">without</a></li>
<li><a href="./xor" title="_.xor([arrays])">xor</a></li>
<li><a href="./xorBy" title="_.xorBy([arrays], [iteratee=_.identity])">xorBy</a></li>
<li><a href="./xorWith" title="_.xorWith([arrays], [comparator])">xorWith</a></li>
<li><a href="./zip" title="_.zip([arrays])">zip</a></li>
<li><a href="./zipObject" title="_.zipObject([props=[]], [values=[]])">zipObject</a></li>
<li><a href="./zipObjectDeep" title="_.zipObjectDeep([props=[]], [values=[]])">zipObjectDeep</a></li>
<li><a href="./zipWith" title="_.zipWith([arrays])">zipWith</a></li>
</ul></li>
<li id="page-tree-collection" class="folder"><span class="folderPage">Collection</span>
<ul>
<li><a href="./countBy" title="_.countBy(collection, [iteratee=_.identity])">countBy</a></li>
<li><a href="./every" title="_.every(collection, [predicate=_.identity])">every</a></li>
<li><a href="./filter" title="_.filter(collection, [predicate=_.identity])">filter</a></li>
<li><a href="./find" title="_.find(collection, [predicate=_.identity])">find</a></li>
<li><a href="./findLast" title="_.findLast(collection, [predicate=_.identity])">findLast</a></li>
<li><a href="./flatMap" title="_.flatMap(collection, [iteratee=_.identity])">flatMap</a></li>
<li><a href="./forEach" title="_.forEach(collection, [iteratee=_.identity])">forEach <span class="aliases">each</span></a></li>
<li><a href="./forEachRight" title="_.forEachRight(collection, [iteratee=_.identity])">forEachRight <span class="aliases">eachRight</span></a></li>
<li><a href="./groupBy" title="_.groupBy(collection, [iteratee=_.identity])">groupBy</a></li>
<li><a href="./includes" title="_.includes(collection, value, [fromIndex=0])">includes</a></li>
<li><a href="./invokeMap" title="_.invokeMap(collection, path, [args])">invokeMap</a></li>
<li><a href="./keyBy" title="_.keyBy(collection, [iteratee=_.identity])">keyBy</a></li>
<li><a href="./map" title="_.map(collection, [iteratee=_.identity])">map</a></li>
<li><a href="./orderBy" title="_.orderBy(collection, [iteratees=[_.identity]], [orders])">orderBy</a></li>
<li><a href="./partition" title="_.partition(collection, [predicate=_.identity])">partition</a></li>
<li><a href="./reduce" title="_.reduce(collection, [iteratee=_.identity], [accumulator])">reduce</a></li>
<li><a href="./reduceRight" title="_.reduceRight(collection, [iteratee=_.identity], [accumulator])">reduceRight</a></li>
<li><a href="./reject" title="_.reject(collection, [predicate=_.identity])">reject</a></li>
<li><a href="./sample" title="_.sample(collection)">sample</a></li>
<li><a href="./sampleSize" title="_.sampleSize(collection, [n=0])">sampleSize</a></li>
<li><a href="./shuffle" title="_.shuffle(collection)">shuffle</a></li>
<li><a href="./size" title="_.size(collection)">size</a></li>
<li><a href="./some" title="_.some(collection, [predicate=_.identity])">some</a></li>
<li><a href="./sortBy" title="_.sortBy(collection, [iteratees=[_.identity]])">sortBy</a></li>
</ul></li>
<li id="page-tree-date" class="folder"><span class="folderPage">Date</span>
<ul>
<li><a href="./now" title="_.now()">now</a></li>
</ul></li>
<li id="page-tree-function" class="folder"><span class="folderPage">Function</span>
<ul>
<li><a href="./after" title="_.after(n, func)">after</a></li>
<li><a href="./ary" title="_.ary(func, [n=func.length])">ary</a></li>
<li><a href="./before" title="_.before(n, func)">before</a></li>
<li><a href="./bind" title="_.bind(func, thisArg, [partials])">bind</a></li>
<li><a href="./bindKey" title="_.bindKey(object, key, [partials])">bindKey</a></li>
<li><a href="./curry" title="_.curry(func, [arity=func.length])">curry</a></li>
<li><a href="./curryRight" title="_.curryRight(func, [arity=func.length])">curryRight</a></li>
<li><a href="./debounce" title="_.debounce(func, [wait=0], [options])" class = "open">debounce</a></li>
<li><a href="./defer" title="_.defer(func, [args])">defer</a></li>
<li><a href="./delay" title="_.delay(func, wait, [args])">delay</a></li>
<li><a href="./flip" title="_.flip(func)">flip</a></li>
<li><a href="./memoize" title="_.memoize(func, [resolver])">memoize</a></li>
<li><a href="./negate" title="_.negate(predicate)">negate</a></li>
<li><a href="./once" title="_.once(func)">once</a></li>
<li><a href="./overArgs" title="_.overArgs(func, [transforms])">overArgs</a></li>
<li><a href="./partial" title="_.partial(func, [partials])">partial</a></li>
<li><a href="./partialRight" title="_.partialRight(func, [partials])">partialRight</a></li>
<li><a href="./rearg" title="_.rearg(func, indexes)">rearg</a></li>
<li><a href="./rest" title="_.rest(func, [start=func.length-1])">rest</a></li>
<li><a href="./spread" title="_.spread(func)">spread</a></li>
<li><a href="./throttle" title="_.throttle(func, [wait=0], [options])">throttle</a></li>
<li><a href="./unary" title="_.unary(func)">unary</a></li>
<li><a href="./wrap" title="_.wrap(value, wrapper)">wrap</a></li>
</ul></li>
<li id="page-tree-lang" class="folder"><span class="folderPage">Lang</span>
<ul>
<li><a href="./castArray" title="_.castArray(value)">castArray</a></li>
<li><a href="./clone" title="_.clone(value)">clone</a></li>
<li><a href="./cloneDeep" title="_.cloneDeep(value)">cloneDeep</a></li>
<li><a href="./cloneDeepWith" title="_.cloneDeepWith(value, [customizer])">cloneDeepWith</a></li>
<li><a href="./cloneWith" title="_.cloneWith(value, [customizer])">cloneWith</a></li>
<li><a href="./eq" title="_.eq(value, other)">eq</a></li>
<li><a href="./gt" title="_.gt(value, other)">gt</a></li>
<li><a href="./gte" title="_.gte(value, other)">gte</a></li>
<li><a href="./isArguments" title="_.isArguments(value)">isArguments</a></li>
<li><a href="./isArray" title="_.isArray(value)">isArray</a></li>
<li><a href="./isArrayBuffer" title="_.isArrayBuffer(value)">isArrayBuffer</a></li>
<li><a href="./isArrayLike" title="_.isArrayLike(value)">isArrayLike</a></li>
<li><a href="./isArrayLikeObject" title="_.isArrayLikeObject(value)">isArrayLikeObject</a></li>
<li><a href="./isBoolean" title="_.isBoolean(value)">isBoolean</a></li>
<li><a href="./isBuffer" title="_.isBuffer(value)">isBuffer</a></li>
<li><a href="./isDate" title="_.isDate(value)">isDate</a></li>
<li><a href="./isElement" title="_.isElement(value)">isElement</a></li>
<li><a href="./isEmpty" title="_.isEmpty(value)">isEmpty</a></li>
<li><a href="./isEqual" title="_.isEqual(value, other)">isEqual</a></li>
<li><a href="./isEqualWith" title="_.isEqualWith(value, other, [customizer])">isEqualWith</a></li>
<li><a href="./isError" title="_.isError(value)">isError</a></li>
<li><a href="./isFinite" title="_.isFinite(value)">isFinite</a></li>
<li><a href="./isFunction" title="_.isFunction(value)">isFunction</a></li>
<li><a href="./isInteger" title="_.isInteger(value)">isInteger</a></li>
<li><a href="./isLength" title="_.isLength(value)">isLength</a></li>
<li><a href="./isMap" title="_.isMap(value)">isMap</a></li>
<li><a href="./isMatch" title="_.isMatch(object, source)">isMatch</a></li>
<li><a href="./isMatchWith" title="_.isMatchWith(object, source, [customizer])">isMatchWith</a></li>
<li><a href="./isNaN" title="_.isNaN(value)">isNaN</a></li>
<li><a href="./isNative" title="_.isNative(value)">isNative</a></li>
<li><a href="./isNil" title="_.isNil(value)">isNil</a></li>
<li><a href="./isNull" title="_.isNull(value)">isNull</a></li>
<li><a href="./isNumber" title="_.isNumber(value)">isNumber</a></li>
<li><a href="./isObject" title="_.isObject(value)">isObject</a></li>
<li><a href="./isObjectLike" title="_.isObjectLike(value)">isObjectLike</a></li>
<li><a href="./isPlainObject" title="_.isPlainObject(value)">isPlainObject</a></li>
<li><a href="./isRegExp" title="_.isRegExp(value)">isRegExp</a></li>
<li><a href="./isSafeInteger" title="_.isSafeInteger(value)">isSafeInteger</a></li>
<li><a href="./isSet" title="_.isSet(value)">isSet</a></li>
<li><a href="./isString" title="_.isString(value)">isString</a></li>
<li><a href="./isSymbol" title="_.isSymbol(value)">isSymbol</a></li>
<li><a href="./isTypedArray" title="_.isTypedArray(value)">isTypedArray</a></li>
<li><a href="./isUndefined" title="_.isUndefined(value)">isUndefined</a></li>
<li><a href="./isWeakMap" title="_.isWeakMap(value)">isWeakMap</a></li>
<li><a href="./isWeakSet" title="_.isWeakSet(value)">isWeakSet</a></li>
<li><a href="./lt" title="_.lt(value, other)">lt</a></li>
<li><a href="./lte" title="_.lte(value, other)">lte</a></li>
<li><a href="./toArray" title="_.toArray(value)">toArray</a></li>
<li><a href="./toInteger" title="_.toInteger(value)">toInteger</a></li>
<li><a href="./toLength" title="_.toLength(value)">toLength</a></li>
<li><a href="./toNumber" title="_.toNumber(value)">toNumber</a></li>
<li><a href="./toPlainObject" title="_.toPlainObject(value)">toPlainObject</a></li>
<li><a href="./toSafeInteger" title="_.toSafeInteger(value)">toSafeInteger</a></li>
<li><a href="./toString" title="_.toString(value)">toString</a></li>
</ul></li>
<li id="page-tree-math" class="folder"><span class="folderPage">Math</span>
<ul>
<li><a href="./add" title="_.add(augend, addend)">add</a></li>
<li><a href="./ceil" title="_.ceil(number, [precision=0])">ceil</a></li>
<li><a href="./floor" title="_.floor(number, [precision=0])">floor</a></li>
<li><a href="./max" title="_.max(array)">max</a></li>
<li><a href="./maxBy" title="_.maxBy(array, [iteratee=_.identity])">maxBy</a></li>
<li><a href="./mean" title="_.mean(array)">mean</a></li>
<li><a href="./min" title="_.min(array)">min</a></li>
<li><a href="./minBy" title="_.minBy(array, [iteratee=_.identity])">minBy</a></li>
<li><a href="./round" title="_.round(number, [precision=0])">round</a></li>
<li><a href="./subtract" title="_.subtract(minuend, subtrahend)">subtract</a></li>
<li><a href="./sum" title="_.sum(array)">sum</a></li>
<li><a href="./sumBy" title="_.sumBy(array, [iteratee=_.identity])">sumBy</a></li>
</ul></li>
<li id="page-tree-methods" class="folder"><span class="folderPage">Methods</span>
<ul>
<li><a href="./templateSettings-imports-_" title="_.templateSettings.imports._">templateSettings.imports._</a></li>
</ul></li>
<li id="page-tree-number" class="folder"><span class="folderPage">Number</span>
<ul>
<li><a href="./clamp" title="_.clamp(number, [min], max)">clamp</a></li>
<li><a href="./inRange" title="_.inRange(number, [start=0], end)">inRange</a></li>
<li><a href="./random" title="_.random([min=0], [max=1], [floating])">random</a></li>
</ul></li>
<li id="page-tree-object" class="folder"><span class="folderPage">Object</span>
<ul>
<li><a href="./assign" title="_.assign(object, [sources])">assign</a></li>
<li><a href="./assignIn" title="_.assignIn(object, [sources])">assignIn <span class="aliases">extend</span></a></li>
<li><a href="./assignInWith" title="_.assignInWith(object, sources, [customizer])">assignInWith <span class="aliases">extendWith</span></a></li>
<li><a href="./assignWith" title="_.assignWith(object, sources, [customizer])">assignWith</a></li>
<li><a href="./at" title="_.at(object, [paths])">at</a></li>
<li><a href="./create" title="_.create(prototype, [properties])">create</a></li>
<li><a href="./defaults" title="_.defaults(object, [sources])">defaults</a></li>
<li><a href="./defaultsDeep" title="_.defaultsDeep(object, [sources])">defaultsDeep</a></li>
<li><a href="./findKey" title="_.findKey(object, [predicate=_.identity])">findKey</a></li>
<li><a href="./findLastKey" title="_.findLastKey(object, [predicate=_.identity])">findLastKey</a></li>
<li><a href="./forIn" title="_.forIn(object, [iteratee=_.identity])">forIn</a></li>
<li><a href="./forInRight" title="_.forInRight(object, [iteratee=_.identity])">forInRight</a></li>
<li><a href="./forOwn" title="_.forOwn(object, [iteratee=_.identity])">forOwn</a></li>
<li><a href="./forOwnRight" title="_.forOwnRight(object, [iteratee=_.identity])">forOwnRight</a></li>
<li><a href="./functions" title="_.functions(object)">functions</a></li>
<li><a href="./functionsIn" title="_.functionsIn(object)">functionsIn</a></li>
<li><a href="./get" title="_.get(object, path, [defaultValue])">get</a></li>
<li><a href="./has" title="_.has(object, path)">has</a></li>
<li><a href="./hasIn" title="_.hasIn(object, path)">hasIn</a></li>
<li><a href="./invert" title="_.invert(object, [multiVal])">invert</a></li>
<li><a href="./invertBy" title="_.invertBy(object, [iteratee=_.identity])">invertBy</a></li>
<li><a href="./invoke" title="_.invoke(object, path, [args])">invoke</a></li>
<li><a href="./keys" title="_.keys(object)">keys</a></li>
<li><a href="./keysIn" title="_.keysIn(object)">keysIn</a></li>
<li><a href="./mapKeys" title="_.mapKeys(object, [iteratee=_.identity])">mapKeys</a></li>
<li><a href="./mapValues" title="_.mapValues(object, [iteratee=_.identity])">mapValues</a></li>
<li><a href="./merge" title="_.merge(object, [sources])">merge</a></li>
<li><a href="./mergeWith" title="_.mergeWith(object, sources, customizer)">mergeWith</a></li>
<li><a href="./omit" title="_.omit(object, [props])">omit</a></li>
<li><a href="./omitBy" title="_.omitBy(object, [predicate=_.identity])">omitBy</a></li>
<li><a href="./pick" title="_.pick(object, [props])">pick</a></li>
<li><a href="./pickBy" title="_.pickBy(object, [predicate=_.identity])">pickBy</a></li>
<li><a href="./result" title="_.result(object, path, [defaultValue])">result</a></li>
<li><a href="./set" title="_.set(object, path, value)">set</a></li>
<li><a href="./setWith" title="_.setWith(object, path, value, [customizer])">setWith</a></li>
<li><a href="./toPairs" title="_.toPairs(object)">toPairs</a></li>
<li><a href="./toPairsIn" title="_.toPairsIn(object)">toPairsIn</a></li>
<li><a href="./transform" title="_.transform(object, [iteratee=_.identity], [accumulator])">transform</a></li>
<li><a href="./unset" title="_.unset(object, path)">unset</a></li>
<li><a href="./values" title="_.values(object)">values</a></li>
<li><a href="./valuesIn" title="_.valuesIn(object)">valuesIn</a></li>
</ul></li>
<li id="page-tree-properties" class="folder"><span class="folderPage">Properties</span>
<ul>
<li><a href="./templateSettings" title="_.templateSettings">templateSettings</a></li>
<li><a href="./templateSettings-escape" title="_.templateSettings.escape">templateSettings.escape</a></li>
<li><a href="./templateSettings-evaluate" title="_.templateSettings.evaluate">templateSettings.evaluate</a></li>
<li><a href="./templateSettings-imports" title="_.templateSettings.imports">templateSettings.imports</a></li>
<li><a href="./templateSettings-interpolate" title="_.templateSettings.interpolate">templateSettings.interpolate</a></li>
<li><a href="./templateSettings-variable" title="_.templateSettings.variable">templateSettings.variable</a></li>
<li><a href="./VERSION" title="_.VERSION">VERSION</a></li>
</ul></li>
<li id="page-tree-seq" class="folder"><span class="folderPage">Seq</span>
<ul>
<li><a href="./_" title="_(value)">_</a></li>
<li><a href="./chain" title="_.chain(value)">chain</a></li>
<li><a href="./prototype-at" title="_.prototype.at([paths])">prototype.at</a></li>
<li><a href="./prototype-chain" title="_.prototype.chain()">prototype.chain</a></li>
<li><a href="./prototype-commit" title="_.prototype.commit()">prototype.commit</a></li>
<li><a href="./prototype-next" title="_.prototype.next()">prototype.next</a></li>
<li><a href="./prototype-plant" title="_.prototype.plant(value)">prototype.plant</a></li>
<li><a href="./prototype-Symbol-iterator" title="_.prototype.Symbol.iterator()">prototype.Symbol.iterator</a></li>
<li><a href="./prototype-value" title="_.prototype.value()">prototype.value <span class="aliases">run, toJSON, valueOf</span></a></li>
<li><a href="./tap" title="_.tap(value, interceptor)">tap</a></li>
<li><a href="./thru" title="_.thru(value, interceptor)">thru</a></li>
<li><a href="./wrapperFlatMap" title="_.wrapperFlatMap([iteratee=_.identity])">wrapperFlatMap</a></li>
</ul></li>
<li id="page-tree-string" class="folder"><span class="folderPage">String</span>
<ul>
<li><a href="./camelCase" title="_.camelCase([string=''])">camelCase</a></li>
<li><a href="./capitalize" title="_.capitalize([string=''])">capitalize</a></li>
<li><a href="./deburr" title="_.deburr([string=''])">deburr</a></li>
<li><a href="./endsWith" title="_.endsWith([string=''], [target], [position=string.length])">endsWith</a></li>
<li><a href="./escape" title="_.escape([string=''])">escape</a></li>
<li><a href="./escapeRegExp" title="_.escapeRegExp([string=''])">escapeRegExp</a></li>
<li><a href="./kebabCase" title="_.kebabCase([string=''])">kebabCase</a></li>
<li><a href="./lowerCase" title="_.lowerCase([string=''])">lowerCase</a></li>
<li><a href="./lowerFirst" title="_.lowerFirst([string=''])">lowerFirst</a></li>
<li><a href="./pad" title="_.pad([string=''], [length=0], [chars=' '])">pad</a></li>
<li><a href="./padEnd" title="_.padEnd([string=''], [length=0], [chars=' '])">padEnd</a></li>
<li><a href="./padStart" title="_.padStart([string=''], [length=0], [chars=' '])">padStart</a></li>
<li><a href="./parseInt" title="_.parseInt(string, [radix])">parseInt</a></li>
<li><a href="./repeat" title="_.repeat([string=''], [n=0])">repeat</a></li>
<li><a href="./replace" title="_.replace([string=''], pattern)">replace</a></li>
<li><a href="./snakeCase" title="_.snakeCase([string=''])">snakeCase</a></li>
<li><a href="./split" title="_.split([string=''], [separator], [limit])">split</a></li>
<li><a href="./startCase" title="_.startCase([string=''])">startCase</a></li>
<li><a href="./startsWith" title="_.startsWith([string=''], [target], [position=0])">startsWith</a></li>
<li><a href="./template" title="_.template([string=''], [options])">template</a></li>
<li><a href="./toLower" title="_.toLower([string=''])">toLower</a></li>
<li><a href="./toUpper" title="_.toUpper([string=''])">toUpper</a></li>
<li><a href="./trim" title="_.trim([string=''], [chars=whitespace])">trim</a></li>
<li><a href="./trimEnd" title="_.trimEnd([string=''], [chars=whitespace])">trimEnd</a></li>
<li><a href="./trimStart" title="_.trimStart([string=''], [chars=whitespace])">trimStart</a></li>
<li><a href="./truncate" title="_.truncate([string=''], [options])">truncate</a></li>
<li><a href="./unescape" title="_.unescape([string=''])">unescape</a></li>
<li><a href="./upperCase" title="_.upperCase([string=''])">upperCase</a></li>
<li><a href="./upperFirst" title="_.upperFirst([string=''])">upperFirst</a></li>
<li><a href="./words" title="_.words([string=''], [pattern])">words</a></li>
</ul></li>
<li id="page-tree-util" class="folder"><span class="folderPage">Util</span>
<ul>
<li><a href="./attempt" title="_.attempt(func)">attempt</a></li>
<li><a href="./bindAll" title="_.bindAll(object, methodNames)">bindAll</a></li>
<li><a href="./cond" title="_.cond(pairs)">cond</a></li>
<li><a href="./conforms" title="_.conforms(source)">conforms</a></li>
<li><a href="./constant" title="_.constant(value)">constant</a></li>
<li><a href="./flow" title="_.flow([funcs])">flow</a></li>
<li><a href="./flowRight" title="_.flowRight([funcs])">flowRight</a></li>
<li><a href="./identity" title="_.identity(value)">identity</a></li>
<li><a href="./iteratee" title="_.iteratee([func=_.identity])">iteratee</a></li>
<li><a href="./matches" title="_.matches(source)">matches</a></li>
<li><a href="./matchesProperty" title="_.matchesProperty(path, srcValue)">matchesProperty</a></li>
<li><a href="./method" title="_.method(path, [args])">method</a></li>
<li><a href="./methodOf" title="_.methodOf(object, [args])">methodOf</a></li>
<li><a href="./mixin" title="_.mixin([object=lodash], source, [options])">mixin</a></li>
<li><a href="./noConflict" title="_.noConflict()">noConflict</a></li>
<li><a href="./noop" title="_.noop()">noop</a></li>
<li><a href="./nthArg" title="_.nthArg([n=0])">nthArg</a></li>
<li><a href="./over" title="_.over(iteratees)">over</a></li>
<li><a href="./overEvery" title="_.overEvery(predicates)">overEvery</a></li>
<li><a href="./overSome" title="_.overSome(predicates)">overSome</a></li>
<li><a href="./property" title="_.property(path)">property</a></li>
<li><a href="./propertyOf" title="_.propertyOf(object)">propertyOf</a></li>
<li><a href="./range" title="_.range([start=0], end, [step=1])">range</a></li>
<li><a href="./rangeRight" title="_.rangeRight([start=0], end, [step=1])">rangeRight</a></li>
<li><a href="./runInContext" title="_.runInContext([context=root])">runInContext</a></li>
<li><a href="./times" title="_.times(n, [iteratee=_.identity])">times</a></li>
<li><a href="./toPath" title="_.toPath(value)">toPath</a></li>
<li><a href="./uniqueId" title="_.uniqueId([prefix])">uniqueId</a></li>
</ul></li>
</ul>
</div>
</nav>
<div id="main" onclick="">
<div id="content" class="markdown-body">
<div data-render-page="entry"><h2>debounce <a class="fa-link" href="./debounce" title="Link to this entry."></a> <a href="https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L8616" title="View in source." target="github">source</a> <a href="https://www.npmjs.com/package/lodash.debounce" title="See the npm package." target="npm">npm</a></h2>
<div class="signature">_.debounce(func, [wait=0], [options])</div>
<div data-render-html="/debounce"><p>创建一个防抖动函数。
该函数会在 <code>wait</code> 毫秒后调用 <code>func</code> 方法。
该函数提供一个 <code>cancel</code> 方法取消延迟的函数调用以及 <code>flush</code> 方法立即调用。
可以提供一个 <code>options</code> 对象决定如何调用 <code>func</code> 方法,
options.leading 与|或 options.trailing 决定延迟前后如何触发。
<code>func</code> 会传入最后一次传入的参数给防抖动函数。
随后调用的防抖动函数返回是最后一次 <code>func</code> 调用的结果。
<br>
<br>
<strong>注意:</strong> 如果 <code>leading</code> 和 <code>trailing</code> 都设定为 true。
则 func 允许 trailing 方式调用的条件为: 在 wait 期间多次调用防抖方法。
<br>
<br>
查看 <a href="http://drupalmotion.com/article/debounce-and-throttle-visual-explanation" target="_blank">David Corbacho's article</a>
了解 <code>_.debounce</code> 与 <code>_.throttle</code> 的区别。</p>
</div>
<h3>参数</h3>
<ol>
<li><span class="param-name">func</span> <span class="param-type">(Function)</span> <div data-render-html="/#synthetic"><p>要防抖动的函数 </p>
</div></li>
<li><span class="param-name">[wait=0]</span> <span class="param-type">(number)</span> <div data-render-html="/#synthetic"><p>需要延迟的毫秒数 </p>
</div></li>
<li><span class="param-name">[options]</span> <span class="param-type">(Object)</span> <div data-render-html="/#synthetic"><p>选项对象 </p>
</div></li>
<li><span class="param-name">[options.leading=false]</span> <span class="param-type">(boolean)</span> <div data-render-html="/#synthetic"><p>指定调用在延迟开始前 </p>
</div></li>
<li><span class="param-name">[options.maxWait]</span> <span class="param-type">(number)</span> <div data-render-html="/#synthetic"><p>设置 <code>func</code> 允许被延迟的最大值 </p>
</div></li>
<li><span class="param-name">[options.trailing=true]</span> <span class="param-type">(boolean)</span> <div data-render-html="/#synthetic"><p>指定调用在延迟结束后 </p>
</div></li>
</ol>
<h3>返回值 <span class="return-type">(Function)</span></h3>
<div class="returns"> <div data-render-html="/#synthetic"><p> 返回具有防抖动功能的函数</p>
</div></div>
<h3>示例</h3>
<div data-render-html="/#synthetic"><pre><code class="lang-js"><span class="token comment" spellcheck="true">// 避免窗口在变动时出现昂贵的计算开销。</span>
<span class="token function" >jQuery</span><span class="token punctuation" >(</span>window<span class="token punctuation" >)</span><span class="token punctuation" >.</span><span class="token function" >on</span><span class="token punctuation" >(</span><span class="token string" >'resize'</span><span class="token punctuation" >,</span> _<span class="token punctuation" >.</span><span class="token function" >debounce</span><span class="token punctuation" >(</span>calculateLayout<span class="token punctuation" >,</span> <span class="token number" >150</span><span class="token punctuation" >)</span><span class="token punctuation" >)</span><span class="token punctuation" >;</span>
<span class="token comment" spellcheck="true">// 当点击时 `sendMail` 随后就被调用。</span>
<span class="token function" >jQuery</span><span class="token punctuation" >(</span>element<span class="token punctuation" >)</span><span class="token punctuation" >.</span><span class="token function" >on</span><span class="token punctuation" >(</span><span class="token string" >'click'</span><span class="token punctuation" >,</span> _<span class="token punctuation" >.</span><span class="token function" >debounce</span><span class="token punctuation" >(</span>sendMail<span class="token punctuation" >,</span> <span class="token number" >300</span><span class="token punctuation" >,</span> <span class="token punctuation" >{</span>
<span class="token string" >'leading'</span><span class="token punctuation" >:</span> <span class="token keyword" >true</span><span class="token punctuation" >,</span>
<span class="token string" >'trailing'</span><span class="token punctuation" >:</span> <span class="token keyword" >false</span>
<span class="token punctuation" >}</span><span class="token punctuation" >)</span><span class="token punctuation" >)</span><span class="token punctuation" >;</span>
<span class="token comment" spellcheck="true">// 确保 `batchLog` 调用1次之后,1秒内会被触发。</span>
<span class="token keyword" >var</span> debounced <span class="token operator" >=</span> _<span class="token punctuation" >.</span><span class="token function" >debounce</span><span class="token punctuation" >(</span>batchLog<span class="token punctuation" >,</span> <span class="token number" >250</span><span class="token punctuation" >,</span> <span class="token punctuation" >{</span> <span class="token string" >'maxWait'</span><span class="token punctuation" >:</span> <span class="token number" >1000</span> <span class="token punctuation" >}</span><span class="token punctuation" >)</span><span class="token punctuation" >;</span>
<span class="token keyword" >var</span> source <span class="token operator" >=</span> <span class="token keyword" >new</span> <span class="token class-name" >EventSource</span><span class="token punctuation" >(</span><span class="token string" >'/stream'</span><span class="token punctuation" >)</span><span class="token punctuation" >;</span>
<span class="token function" >jQuery</span><span class="token punctuation" >(</span>source<span class="token punctuation" >)</span><span class="token punctuation" >.</span><span class="token function" >on</span><span class="token punctuation" >(</span><span class="token string" >'message'</span><span class="token punctuation" >,</span> debounced<span class="token punctuation" >)</span><span class="token punctuation" >;</span>
<span class="token comment" spellcheck="true">// 取消一个 trailing 的防抖动调用</span>
<span class="token function" >jQuery</span><span class="token punctuation" >(</span>window<span class="token punctuation" >)</span><span class="token punctuation" >.</span><span class="token function" >on</span><span class="token punctuation" >(</span><span class="token string" >'popstate'</span><span class="token punctuation" >,</span> debounced<span class="token punctuation" >.</span>cancel<span class="token punctuation" >)</span><span class="token punctuation" >;</span>
</code></pre>
</div>
<div id="disqus_thread" style="margin-top:50px;"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Repla<p></p>ce PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
var disqus_config = function () {
this.page.identifier = 'debounce';
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//lodash-zh.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript></div>
</div>
</div>
</div>
<script>window.pubRef = {"href":"/debounce","relPath":"."};</script>
<script src="./js/jquery-1.11.3.min.js" ></script>
<script src="./js/lodash-zh.js" ></script>
<script src="./js/doc.js" ></script>
<!-- copyright -->
</body>
</html>