/**
 * Copyright (c) 2021 Dell Inc., or its subsidiaries. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 */ const defaultDebounce = 500 ; const DebounceDisabled = false ; export class DebounceUtils { debounceTimer : any = null ; param evt param func param debounce param debounceTime public debounce = ( evt , func , debounce ? , debounceTime ? ) => { if ( ! func ) { return func ; } if ( debounce === true ) { const waitTime = debounceTime || defaultDebounce ; evt . persist ( ) ; const triggerFunction = ( evt ) => { func . apply ( this , [ evt ] ) ; } ; clearTimeout ( this . debounceTimer ) ; this . debounceTimer = setTimeout ( ( ) => triggerFunction ( evt ) , waitTime ) ; } else { func . apply ( this , [ evt ] ) ; return ; } } ; }