Home>

with jQuery works, and with pure JS no.

const {debound}= require ("LODASH");
Window.OnResize= ()= >
 {
  Debounce (()= >
 Console.log ("123"), 100);
}; 

If you write so everything works

window.onresize= ()= >
 {
  Console.log ("123");
};

also tried to write with AddEventlistener. also does not work.

window.addeventlistener ("Onresize", debound (()= >
 Console.log ("123"), 100));

In AddEventListner, you need to transmit the name of the event without ON

Grundy♦2021-07-21 18:42:53

Because you create a function, but do not call it. Try this. Window.OnResize= Debounce (()=>Console.log ("123"), 100);

Андрей NOP2021-07-21 20:32:35

@ Andreynop Thank you very much.

Demon __2021-07-21 21:01:38

Another option -Add Return before Debounce

Андрей NOP2021-07-21 21:27:06