Error When Web Components Send a Message to an HTML5 Page
As I am developing huawei quick app,When Web Components send a message to an HTML5 page, the following JS error is reported: 02–14 09:22:56.329 E/jsLog (18834): [H5]Uncaught TypeError: system.onmessage is not a function how can I solve it?
Ensure that the
system.onmessagefunction in the HTML5 page only contains the necessary logic, that is, receiving data transmitted from a quick app page. You can leave other logic, for example, handling
onloadevents, to lifecyle functions of the HTML5 page for processing. Note that data from the quick app is not received once the
onloadevent is triggered. In this case, the HTML5 page needs to listen to data receiving in polling mode. To achieve this, refer to the following sample code.
The following code is not recommended.
You should understand the mechanism for sending messages between a quick app and an HTML5 page. Then use the polling mode to solve the asynchronous data transmission problem.