Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "poll"

Poll

Repeat run function until return true.

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

Index

Interfaces

Type aliases

Functions

Type aliases

Func

Func: () => boolean | Promise<boolean>

Type declaration

    • (): boolean | Promise<boolean>
    • Returns boolean | Promise<boolean>

Functions

Const run

  • poll with fixed time interval

    example
    poll.run(()=>{
      return document.querySelector('#a') !== null;
    }).then(()=>{
      // function return true
    }).catch(()=>{
      // until timeout function return false
    })

    Parameters

    • func: Func
    • Default value options: RunOptions = { timeout: 2000, interval: 100 }

    Returns Promise<void>

Generated using TypeDoc