You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It just spawns request on every search field change
Also queue.spawn({url: ''}) - would be great if it was possible just call service url queue.spawn({SomeService('updateItem')) - maybe not this way, but u got idea :)
The text was updated successfully, but these errors were encountered:
I think this package should be rewritten from scratch but I haven't enough time for that, sorry.
I hope someday I'll do it
You can use my latest package wait-and-go and combine with classic debounce
importcreateWaiterfrom"wait-and-go"constafterRequest=createWaiter('Request')letcurrentconstdebouncedReq=payload=>{if(current){clearTimeout(current)}current=setTimeout(()=>{afterRequest.do(()=>Service.doRequest(payload)},1000)}// This one is called after each call afterRequest(result=>{console.log(result)})
Snippet for more accurate:
// Save this function anywhereexportconstdebounceReq=(Service,time)=>{constafterRequest=createWaiter('Request')letcurrentconstdebouncedReq=payload=>{if(current){clearTimeout(current)}current=setTimeout(()=>{afterRequest.do(()=>Service.doRequest(payload)},1000)}return{start: debouncedReq,onFinish: afterRequest}}// Usageconstsearch=debounceReq(Service.extend({url: 'search'}),1000)search.start({url: '?q=test'})search.onFinish(console.log)
Well i have latest version...
Some base service
It just spawns request on every search field change
Also queue.spawn({url: ''}) - would be great if it was possible just call service url
queue.spawn({SomeService('updateItem'))
- maybe not this way, but u got idea :)The text was updated successfully, but these errors were encountered: