"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/hoppscotch-app/helpers/utils/debounce.js" between
hoppscotch-2.2.1.tar.gz and hoppscotch-3.0.0.tar.gz

About: Hoppscotch is a light-weight, web based API development suite.

debounce.js  (hoppscotch-2.2.1):debounce.js  (hoppscotch-3.0.0)
// Debounce is a higher order function which makes its enclosed function be exec uted // Debounce is a higher order function which makes its enclosed function be exec uted
// only if the function wasn't called again till 'delay' time has passed, this h elps reduce impact of heavy working // only if the function wasn't called again till 'delay' time has passed, this h elps reduce impact of heavy working
// functions which might be called frequently // functions which might be called frequently
// NOTE : Don't use lambda functions as this doesn't get bound properly in them, use the 'function (args) {}' format // NOTE : Don't use lambda functions as this doesn't get bound properly in them, use the 'function (args) {}' format
const debounce = (func, delay) => { const debounce = (func, delay) => {
let inDebounce let inDebounce
return function () { return function (...args) {
const context = this
const args = arguments
clearTimeout(inDebounce) clearTimeout(inDebounce)
inDebounce = setTimeout(() => func.apply(context, args), delay) inDebounce = setTimeout(() => func.apply(this, args), delay)
} }
} }
export default debounce export default debounce
 End of changes. 2 change blocks. 
4 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)