360 the desktop jsapi has a strange BUG: the client communicates with the webpage through JS

Source: Internet
Author: User

The bug scenario is probably like this:

Desktop .exeEmbedWebpage .htmlThe webpage uses js to call the js api functions of the desktop.Fn1And then call the js api function.FN2. As a result, fn1 runs normally, but subsequent FN2 does not run.

After debugging by a colleague, the problem was solved using setTimeout.

SetTimeout (function () {window. External. FN2 () ;}, 0 );

Since setTimeout is used to reschedule an events loop, it is certain that both fn1 and FN2 conflict with each other. Later I thought about the cause of the bug:

The JS on the page calls fn1to send a notification to table .exe,Table .exe will be in the "busy" statusIn this case, other notifications sent by JS are ignored, as FN2 is not executed.

The perfect design should be the callback form, but the js api provided by table .exe is not callback + Blocking. The Desktop client should support asynchronous/queuing when receiving notifications from Js. Therefore, there is room for improvement in the js api design of 360 desktop.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.