Skip to content

Instantly share code, notes, and snippets.

@kewitz
Created December 14, 2016 23:21
Show Gist options
  • Save kewitz/008e686530310312a3c07083a6e919cd to your computer and use it in GitHub Desktop.
Save kewitz/008e686530310312a3c07083a6e919cd to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
const debounce = (func, delay) => {
let timeout
return args => {
if (timeout) clearTimeout(timeout)
timeout = setTimeout(func.bind(null, args), delay)
}
}
const debouncedLog = debounce((a) => console.log(a), 1000)
debouncedLog('ok')
debouncedLog('not')
{
"name": "esnextbin-sketch",
"version": "0.0.0"
}
'use strict';
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
var debounce = function debounce(func, delay) {
var timeout = void 0;
return function (args) {
if (timeout) clearTimeout(timeout);
timeout = setTimeout(func.bind(null, args), delay);
};
};
var debouncedLog = debounce(function (a) {
return console.log(a);
}, 1000);
debouncedLog('ok');
debouncedLog('not');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment