When customizing JSAPI, what are the differences between interceptEvent and handleEvent?
Answer: If you want to monitor other events of the container, write your code in interceptEvent. If you want to handle the event only by yourself, write your code in handleEvent and remember to return true.
If you return true, the event will stop propagating. If your return false, the event will continue to propagate to other plugins.
When customizing JSAPI, I have added the events in config.setEvents("event"). Why is it that I also have to add the events in onPrepare of the plugin?
Answer: Because the plugin of the container is lazily loaded, that is, it is loaded upon page creation. The HTML5 container injects the events to be monitored through external config.setEvents. So, the corresponding plugin object will be instantiated only when there are actual JavaScript calls. For the actual instantiated plugin, the events distributed are those in onPrepare in the plugin. So, you must ensure the events added in config.setEvents("event") are consistent with those in the internal onPrepare.
What are the differences between page, session, and service registered by the customized JSAPI plugin?
Answer: A page corresponds to a webview. A session corresponds to an App object in mPaaS. A service is a global singleton.
If the plugin is registered at page level, a plugin instance is created every time you create a WebView, and the onRelease of the corresponding plugin is called back when the WebView is disposed.
If the plugin is registered at session level, a plugin is created every time you create an App object.
If the plugin is registered at service level, only one plugin is created globally, and it is created when your open the container for the first time.
The purpose of signature verification is to verify source of the offline package? Or will it perform integrity verification?
Answer: On the offline package releasing platform, if you configure a private signature key, the amr file issued by the platform will carry the signature information of the offline package (the ciphertext obtained by encrypting the hash value of the offline package with the private key). When verifying the signature, the public key preset in the project will be used to verify the signature (decrypt the ciphertext in the previous step to get the hash value, calculate the hash of the offline package locally, and determine whether the two are the same). This process ensures that the content of the offline package is complete and the source of the offline package is correct.
When opening an offline package, why is that I cannot hide the ProgressBar?
Answer: You may encounter this problem when resources fail to go offline and the page falls back to online mode. In fallback mode, the HTML5 container forcibly limits the progress bar and you cannot hide it by setting the SHOW_PROGRESS startup parameter.