Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "debounce"

module

decorator

Index

Functions

Functions

debounce

  • debounce<T>(time: number): (Anonymous function)
  • Add debounce to a function.

    Type parameters

    • T: function

      type or interface of origin function.

    Parameters

    • time: number

      debounce time.

    Returns (Anonymous function)

    The behavior is the same as origin function, but with debounce.

    const origin = () => ...;
    const result = debounce(250)(origin);
    class Greeter {
        greeting: string;
        constructor(message: string) {
            this.greeting = message;
        }
    
        @debounce(500)
        greet = () => `Hello, ${this.greeting}`;
    }

Generated using TypeDoc