Make async event synchronous in JavaScript

后端 未结 5 1802
迷失自我
迷失自我 2021-01-14 04:06

I\'m using the WPF 3.5SP1 WebBrowser control to display a page containing some javascript functions. My program then needs to invoke a javascript function which will make an

5条回答
  •  庸人自扰
    2021-01-14 04:56

    See related question: Can you wait for javascript callback?

    Quoting from a quote in my answer to that question:

    JavaScript Strands adds coroutine and cooperative threading support to the JavaScript language to enable blocking capabilities for asynchronous event callbacks.

    And more:

    Narrative JavaScript is a small extension to the JavaScript language that enables blocking capabilities for asynchronous event callbacks. This makes asynchronous code refreshingly readable and comprehensible.

    Although making normally asynchronous code behave as synchronous is technically possible, I would recommend that you reconsider your design to go with an asynchronous approach.

提交回复
热议问题