Size: a a a

2020 May 18

d

dsgnrvd in pro.js
ну, если импортить по функции из лодаша - это еще более менее
источник

in pro.js
Denis Efremov
Юзать лодаш в 2020 — моветон
а что должно быть вместо его
источник

d

dsgnrvd in pro.js
аналогичный дебаунс со стаковерфлоу
export function debounce (fn, delay) {
 var timeoutID = null
 return function () {
   clearTimeout(timeoutID)
   var args = arguments
   var that = this
   timeoutID = setTimeout(function () {
     fn.apply(that, args)
   }, delay)
 }
}
источник

S

Syntax Highlight Bot in pro.js
dsgnrvd
аналогичный дебаунс со стаковерфлоу
export function debounce (fn, delay) {
 var timeoutID = null
 return function () {
   clearTimeout(timeoutID)
   var args = arguments
   var that = this
   timeoutID = setTimeout(function () {
     fn.apply(that, args)
   }, delay)
 }
}
источник

В

Виктория in pro.js
dsgnrvd
аналогичный дебаунс со стаковерфлоу
export function debounce (fn, delay) {
 var timeoutID = null
 return function () {
   clearTimeout(timeoutID)
   var args = arguments
   var that = this
   timeoutID = setTimeout(function () {
     fn.apply(that, args)
   }, delay)
 }
}
Ок
источник

d

dsgnrvd in pro.js
но твой вариант тоже норм
источник

d

dsgnrvd in pro.js
я просто тупой и под 10 час работы уже трудно впендюрить это во вью
источник

В

Виктория in pro.js
dsgnrvd
аналогичный дебаунс со стаковерфлоу
export function debounce (fn, delay) {
 var timeoutID = null
 return function () {
   clearTimeout(timeoutID)
   var args = arguments
   var that = this
   timeoutID = setTimeout(function () {
     fn.apply(that, args)
   }, delay)
 }
}
уаттт??
источник

d

dsgnrvd in pro.js
чо
источник

В

Виктория in pro.js
that :D
источник

d

dsgnrvd in pro.js
нормас
источник

d

dsgnrvd in pro.js
работает как надо xВ
источник

d

dsgnrvd in pro.js
xD
источник

CM

Chingiz Mamiyev in pro.js
+
источник

d

dsgnrvd in pro.js
аналогичный по функционалу имею ввиду
источник

DE

Denis Efremov in pro.js
// Credit David Walsh (https://davidwalsh.name/javascript-debounce-function)

// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
 var timeout;

 // This is the function that is actually executed when
 // the DOM event is triggered.
 return function executedFunction() {
   // Store the context of this and any
   // parameters passed to executedFunction
   var context = this;
   var args = arguments;
     
   // The function to be called after
   // the debounce time has elapsed
   var later = function() {
     // null timeout to indicate the debounce ended
     timeout = null;
     
     // Call function now if you did not on the leading end
     if (!immediate) func.apply(context, args);
   };

   // Determine if you should call the function
   // on the leading or trail end
   var callNow = immediate && !timeout;
 
   // This will reset the waiting every function execution.
   // This is the step that prevents the function from
   // being executed because it will never reach the
   // inside of the previous setTimeout  
   clearTimeout(timeout);
 
   // Restart the debounce waiting period.
   // setTimeout returns a truthy value (it differs in web vs node)
   timeout = setTimeout(later, wait);
 
   // Call immediately if you're dong a leading
   // end execution
   if (callNow) func.apply(context, args);
 };
источник

S

Syntax Highlight Bot in pro.js
Denis Efremov
// Credit David Walsh (https://davidwalsh.name/javascript-debounce-function)

// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
 var timeout;

 // This is the function that is actually executed when
 // the DOM event is triggered.
 return function executedFunction() {
   // Store the context of this and any
   // parameters passed to executedFunction
   var context = this;
   var args = arguments;
     
   // The function to be called after
   // the debounce time has elapsed
   var later = function() {
     // null timeout to indicate the debounce ended
     timeout = null;
     
     // Call function now if you did not on the leading end
     if (!immediate) func.apply(context, args);
   };

   // Determine if you should call the function
   // on the leading or trail end
   var callNow = immediate && !timeout;
 
   // This will reset the waiting every function execution.
   // This is the step that prevents the function from
   // being executed because it will never reach the
   // inside of the previous setTimeout  
   clearTimeout(timeout);
 
   // Restart the debounce waiting period.
   // setTimeout returns a truthy value (it differs in web vs node)
   timeout = setTimeout(later, wait);
 
   // Call immediately if you're dong a leading
   // end execution
   if (callNow) func.apply(context, args);
 };
источник

В

Виктория in pro.js
Всё понятно
Но раздуто слишком
источник

DE

Denis Efremov in pro.js
Виктория
Всё понятно
Но раздуто слишком
Для тебя дули
источник

DE

Denis Efremov in pro.js
источник