Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "once"

Once

Return a function only can run noce.

import { once } from '@mochen/yuumi';

Index

Functions

Functions

once

  • once<T>(callback: T, context?: Object): T
  • Return a function only can run noce.

    example
    const runOnce = once(()=>{
     console.log('1');
    });
    
    runOnce(); // output '1'
    runOnce(); // do nothing

    Type parameters

    • T: Function

    Parameters

    • callback: T
    • Optional context: Object

    Returns T

Generated using TypeDoc