Wait until a condition is true?

前端 未结 7 1916
日久生厌
日久生厌 2020-12-09 08:32

I\'m using navigator.geolocation.watchPosition in JavaScript, and I want a way to deal with the possibility that the user might submit a form relying on locatio

7条回答
  •  有刺的猬
    2020-12-09 09:15

    This is precisely what promises were invented and implemented (since OP asked his question) for.

    See all of the various implementations, eg promisejs.org

提交回复
热议问题