Skip to content

Commit d7580cd

Browse files
committed
Rename from stashbounce to mergebounce
1 parent 7b4a9fd commit d7580cd

7 files changed

+22
-22
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ node_modules: package.json package-lock.json
77

88
.PHONY: eslint
99
eslint: node_modules
10-
$(ESLINT) stashbounce.js
10+
$(ESLINT) mergebounce.js
1111

1212
.PHONY: check
13-
check: eslint
13+
check: eslint dist
1414
$(KARMA) start karma.conf.js $(ARGS)
1515

1616

17-
dist/stashdebounce.js:
17+
dist/mergebounce.js:
1818
$(ROLLUP) --config rollup.config.js
1919

2020
.PHONY: check
21-
dist: node_modules stashbounce.js dist/stashdebounce.js
21+
dist: node_modules mergebounce.js dist/mergebounce.js

karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function(config) {
1313

1414
// list of files / patterns to load in the browser
1515
files: [
16-
'./dist/stashbounce.js',
16+
'./dist/mergebounce.js',
1717
'./tests.js'
1818
],
1919

stashbounce.js mergebounce.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const nativeMin = Math.min;
2727
*
2828
* @static
2929
* @category Function
30-
* @param {Function} func The function to stashbounce.
30+
* @param {Function} func The function to mergebounce.
3131
* @param {number} [wait=0] The number of milliseconds to delay.
3232
* @param {Object} [options={}] The options object.
3333
* @param {number} [options.maxWait]
@@ -36,20 +36,20 @@ const nativeMin = Math.min;
3636
* @example
3737
*
3838
* // Avoid costly calculations while the window size is in flux.
39-
* window.addEventListener('resize', stashbounce(calculateLayout, 150));
39+
* window.addEventListener('resize', mergebounce(calculateLayout, 150));
4040
*
4141
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
42-
* element.addEventListner('click', stashbounce(sendMail, 300));
42+
* element.addEventListner('click', mergebounce(sendMail, 300));
4343
*
4444
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
45-
* const stashbounced = stashbounce(batchLog, 250, { 'maxWait': 1000 });
45+
* const mergebounced = mergebounce(batchLog, 250, { 'maxWait': 1000 });
4646
* const source = new EventSource('/stream');
47-
* jQuery(source).on('message', stashbounced);
47+
* jQuery(source).on('message', mergebounced);
4848
*
4949
* // Cancel the trailing debounced invocation.
50-
* window.addEventListener('popstate', stashbounced.cancel);
50+
* window.addEventListener('popstate', mergebounced.cancel);
5151
*/
52-
function stashbounce(func, wait, options) {
52+
function mergebounce(func, wait, options) {
5353
let lastArgs = [],
5454
lastThis,
5555
maxWait,
@@ -187,4 +187,4 @@ function stashbounce(func, wait, options) {
187187
return debounced;
188188
}
189189

190-
export default stashbounce;
190+
export default mergebounce;

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "stashbounce",
2+
"name": "mergebounce",
33
"version": "0.0.1",
44
"description": "A debounce implementation that merges passed in objects before finally sending them to the debounced function",
5-
"main": "stashbounce.js",
5+
"main": "mergebounce.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},

rollup.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ const includePathOptions = {
99

1010

1111
export default {
12-
input: 'stashbounce.js',
12+
input: 'mergebounce.js',
1313
output: [
1414
{
15-
file: 'dist/stashbounce.js',
15+
file: 'dist/mergebounce.js',
1616
format: 'iife',
17-
name: 'stashbounce',
17+
name: 'mergebounce',
1818
}
1919
],
2020
plugins: [ includePaths(includePathOptions) ],

tests.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/*global describe, it, expect, stashbounce */
1+
/*global describe, it, expect, mergebounce */
22

3-
describe("Stashbounce", function () {
3+
describe("mergebounce", function () {
44

55
it("merges passed in parameters before invoking the function", function (done) {
66
let invokedData;
7-
const debounced = stashbounce(function (data) { invokedData = data }, 10);
7+
const debounced = mergebounce(function (data) { invokedData = data }, 10);
88
debounced({'a': [{ 'b': 2 }, { 'd': 4 }]});
99
debounced({'a': [{ 'c': 3 }, { 'e': 5 }]});
1010

0 commit comments

Comments
 (0)