Function windowLoaded

  • EN: Check whether the page is loaded successfully (Keep the compatibility if the browser's load event has been triggered).

    ZH: 页面加载完成。

    Usage:

    windowLoaded()
    .then(res => {
    console.log(`Load Success: ${res}`);
    })
    .catch(err => {
    console.log(`Load Timeout or Fail: ${err.message}`);
    });

    Output:

    Load Success: load
    

    Parameters

    • timeout: number = 90

      超时时间 / 单位:秒

    Returns Promise<string | Error>

    document is loaded? 'complete' 'load' / 'timeout'