|
|
@ -52,16 +52,16 @@ export function prepareUrl(url) {
|
|
|
|
return new UrlBuilder(url)
|
|
|
|
return new UrlBuilder(url)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function debounce(fn, delay = 500) {
|
|
|
|
// export function debounce(fn, delay = 500) {
|
|
|
|
let timer
|
|
|
|
// let timer
|
|
|
|
return e => {
|
|
|
|
// return e => {
|
|
|
|
e.persist()
|
|
|
|
// e.persist()
|
|
|
|
clearTimeout(timer)
|
|
|
|
// clearTimeout(timer)
|
|
|
|
timer = setTimeout(() => {
|
|
|
|
// timer = setTimeout(() => {
|
|
|
|
fn(e)
|
|
|
|
// fn(e)
|
|
|
|
}, delay)
|
|
|
|
// }, delay)
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
export function throttle(fn, delay, atleast) {
|
|
|
|
export function throttle(fn, delay, atleast) {
|
|
|
|
let timeout = null,
|
|
|
|
let timeout = null,
|
|
|
@ -409,19 +409,19 @@ export const stringToColour = (str) => {
|
|
|
|
return colour
|
|
|
|
return colour
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// export const debounce = (func, wait, immediate) => {
|
|
|
|
export const debounce = (func, wait, immediate) => {
|
|
|
|
// var timeout;
|
|
|
|
var timeout;
|
|
|
|
// return function () {
|
|
|
|
return function () {
|
|
|
|
// var context = this,
|
|
|
|
var context = this,
|
|
|
|
// args = arguments;
|
|
|
|
args = arguments;
|
|
|
|
// clearTimeout(timeout);
|
|
|
|
clearTimeout(timeout);
|
|
|
|
// if (immediate && !timeout) func.apply(context, args);
|
|
|
|
if (immediate && !timeout) func.apply(context, args);
|
|
|
|
// timeout = setTimeout(function () {
|
|
|
|
timeout = setTimeout(function () {
|
|
|
|
// timeout = null;
|
|
|
|
timeout = null;
|
|
|
|
// if (!immediate) func.apply(context, args);
|
|
|
|
if (!immediate) func.apply(context, args);
|
|
|
|
// }, wait);
|
|
|
|
}, wait);
|
|
|
|
// };
|
|
|
|
};
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const olog = (text, ...args) => {
|
|
|
|
export const olog = (text, ...args) => {
|
|
|
|
console.log(
|
|
|
|
console.log(
|
|
|
|