package com.example.base.extensions

import android.view.View

fun View.onClick(debounceTime: Long = 500, action: (View) -> Unit) {
    this.setOnClickListener(object : View.OnClickListener {
        var lastClickTime = 0L

        override fun onClick(v: View) {
            if (System.currentTimeMillis() - lastClickTime >= debounceTime) {
                action(v)
                lastClickTime = System.currentTimeMillis()
            }
        }
    })
}