mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v 0.8.14b
This commit is contained in:
parent
edc3fc1826
commit
f81fd8a94c
8 changed files with 100 additions and 41 deletions
|
|
@ -433,4 +433,20 @@ function getAbsolutePath(href) {
|
|||
var link = document.createElement("a");
|
||||
link.href = href;
|
||||
return link.href;
|
||||
}
|
||||
}
|
||||
|
||||
// from https://davidwalsh.name/javascript-debounce-function
|
||||
function debounce(func, wait, immediate) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var context = this, args = arguments;
|
||||
var later = function() {
|
||||
timeout = null;
|
||||
if (!immediate) func.apply(context, args);
|
||||
}
|
||||
var callNow = immediate && !timeout;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(later, wait);
|
||||
if (callNow) func.apply(context, args);
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue