It is recommended to use the WMPFMiniProgramApi.preload interface.
Trigger the runtime preload for a Mini Program to improve its loading speed.
Preload only once. Repeated calls will trigger a new preload. Invoke this based on your specific business needs. It is recommended to perform the preload during idle periods after a Mini Program has been used.
Call Parameters
No parameters
Return Parameters
No parameters
Sample Code
val request = WMPFPreloadRuntimeRequest().apply {
baseRequest = WMPFBaseRequestHelper.checked()
}
val result = WMPFIPCInvoker.invokeAsync<IPCInvokerTask_PreloadRuntime,
WMPFPreloadRuntimeRequest, WMPFPreloadRuntimeResponse>(
request,
IPCInvokerTask_PreloadRuntime::class.java
) { response ->
if (isSuccess(response)) {
it.onSuccess(response)
} else {
it.onError(TaskErrorException(createTaskError(response)))
}
}
if (!result) {
it.onError(Exception("invoke preloadRuntime fail"))
}