zoukankan      html  css  js  c++  java
  • Promise.timeout()

    Promise.timeout method

    This method has two forms: WinJS.Promise.timeout(timeout) and WinJS.Promise.timeout(timeout, promise)WinJS.Promise.timeout(timeout) creates a promise that is completed asynchronously after the specified timeout, essentially wrapping a call to setTimeout within a promise. WinJS.Promise.timeout(timeout, promise) sets a timeout period for completion of the specified promise, automatically canceling the promise if it is not completed within the timeout period.

    Syntax

    1. promise.timeout(timeout, promise).done( /* Your success and error handlers */ );

    Parameters

    timeout

    Type: Number

    The timeout period in milliseconds. If this value is zero or not specified, msSetImmediate is called, otherwise setTimeout is called.

    promise

    Type: Promise

    Optional. A promise that will be canceled if it doesn't complete within the timeout period.

    Return value

    Type: Promise

    If the promise parameter is omitted, returns a promise that will be fulfilled after the timeout period. If the promise paramater is provided, the same promise is returned.



  • 相关阅读:
    好用的jsDelivr
    纯css实现图片或者页面变灰色
    三元表达式的连写
    markdown常用语法小结
    vue中的事件修饰符
    ES6笔记一
    less使用小结
    flex布局小结
    所思所想,关于坚持
    前端渲染图片报403问题解决方案
  • 原文地址:https://www.cnblogs.com/puncha/p/3876968.html
Copyright © 2011-2022 走看看