Resource preloading method and device in cross-end scene, equipment and storage medium
By leveraging the collaborative work of cache pools and sub-threads in cross-platform scenarios, efficient preloading of resource cards is achieved, solving the problem of low resource preloading efficiency in cross-platform scenarios and improving user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2026-03-13
AI Technical Summary
In cross-platform scenarios, how can we effectively implement resource preloading to reduce user waiting time and improve user experience?
By responding to preload requests, resource data is obtained and stored in a cache pool. Pre-rendering is performed using the first child thread, while the interactive event binding and data updates of the second child thread are paused to ensure pre-rendering performance.
It improves the preloading efficiency of resource cards, reduces the time spent on the first screen, and enhances the user's browsing experience.
Smart Images

Figure CN121658734A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing, and in particular to a method, apparatus, device and storage medium for resource preloading in cross-platform scenarios. Background Technology
[0002] Cross-platform development refers to cross-platform development between the client and the front-end. Cross-platform development enables interaction and collaboration between client-side code and front-end code. For example, front-end code can drive client-side code to render resource data for display on the page.
[0003] Currently, in multimedia resource display scenarios based on cross-platform technology, relevant resource data is preloaded before users view resource cards to reduce user waiting time and provide a smoother user experience.
[0004] How to achieve resource preloading in cross-platform scenarios is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a resource preloading method, apparatus, device, and storage medium for cross-platform scenarios.
[0006] In a first aspect, embodiments of this disclosure provide a resource preloading method in a cross-platform scenario, the method comprising:
[0007] In response to a preload request for a target resource card, the resource data of the target resource card is obtained and stored in a cache pool; wherein, the target resource card is used to display in a target list generated based on client-side code, and the target resource card is generated based on front-end code;
[0008] The first sub-thread is invoked to read the resource data of the target resource card from the cache pool, and the rendering module generated based on the client code is driven to pre-render the target resource card. The pre-rendering result of the target resource card is stored in the cache pool for display in the target list.
[0009] The second sub-thread is paused for the target resource card; wherein the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
[0010] In one optional implementation, the method further includes:
[0011] Based on the pre-rendered results of the target resource card, the target resource card is displayed in the target list;
[0012] In response to the target resource card being displayed in the target list, the second sub-thread is started to perform interactive event binding and request data updates for the target resource card.
[0013] In one optional implementation, the method further includes:
[0014] In response to a request to update data for the target resource card, return data for the target resource card is obtained;
[0015] If it is determined based on the returned data that the target resource card needs to be updated, the second sub-thread drives the first sub-thread to re-render the target resource card based on the returned data of the target resource card, and updates the target resource card in the target list based on the re-rendering result.
[0016] In an optional implementation, after launching the second sub-thread in response to the display of the target resource card to perform interactive event binding and request data update for the target resource card, the method further includes:
[0017] In response to the target resource card being removed from the target list, the second sub-thread is paused for the target resource card to suspend the execution of interactive event binding and data update requests for the target resource card.
[0018] In an optional implementation, before pausing the invocation of the second sub-thread for the target resource card in response to the target resource card being removed from the target list, to pause the execution of interactive event binding and data update requests for the target resource card, the method further includes:
[0019] In response to a swipe operation on the target list, determine whether the target resource card should be removed from the target list.
[0020] In an optional implementation, before obtaining the resource data of the target resource card and storing it in the cache pool in response to a preloading request for the target resource card, the method further includes:
[0021] In response to a swipe operation on the target list, a target resource card is determined from the media resource stream of the target list based on the swipe direction of the swipe operation, and a preload request for the target resource card is triggered; wherein the media resource stream includes resource cards for display in the target list.
[0022] In an optional implementation, before obtaining the resource data of the target resource card and storing it in the cache pool in response to a preloading request for the target resource card, the method further includes:
[0023] In response to the target list not being scrolled, a target resource card is determined from the media resource stream of the target list, and a preload request for the target resource card is triggered; wherein the media resource stream includes resource cards for display in the target list.
[0024] Secondly, this disclosure provides a resource preloading device for cross-platform scenarios, the device comprising:
[0025] The first acquisition module is used to respond to a preloading request for a target resource card, acquire the resource data of the target resource card and store it in a cache pool; wherein, the target resource card is used to display in a target list generated based on client code, and the target resource card is generated based on front-end code;
[0026] The first rendering module is used to call the first sub-thread to read the resource data of the target resource card from the cache pool, drive the rendering module generated based on the client code to pre-render the target resource card, and store the pre-rendered result of the target resource card into the cache pool for display in the target list.
[0027] The first pause module is used to pause the invocation of the second sub-thread for the target resource card; wherein, the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
[0028] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the resource preloading method in a cross-platform scenario as provided in embodiments of this disclosure.
[0029] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program for executing the resource preloading method in a cross-platform scenario as provided in embodiments of this disclosure.
[0030] Fifthly, this disclosure provides a computer program product comprising a computer program / instruction that, when executed by a processor, implements the method described above.
[0031] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0032] In the cross-platform resource preloading method provided in this embodiment, firstly, in response to a preloading request for a target resource card, the resource data of the target resource card is obtained and stored in a cache pool. The target resource card is used to display in a target list generated based on client-side code. The target resource card is generated based on front-end code. Then, a first sub-thread is called to read the resource data of the target resource card from the cache pool, driving the rendering module generated based on client-side code to pre-render the target resource card. The pre-rendered result of the target resource card is stored in the cache pool for display in the target list. The second sub-thread is called for the target resource card, and the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
[0033] After receiving a preloading request, this embodiment of the present disclosure pauses the call to the second sub-thread used for executing interactive event binding and requesting updated data during the process of calling the first sub-thread to drive the rendering module to pre-render the target resource card. This ensures the performance requirements of pre-rendering, improves the preloading efficiency of resource cards in cross-platform scenarios, reduces the first-screen time of resource cards, and enhances the user's browsing experience. Attached Figure Description
[0034] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0035] Figure 1 A flowchart illustrating a resource preloading method in a cross-platform scenario provided by an embodiment of this disclosure;
[0036] Figure 2 A flowchart illustrating another resource preloading method in a cross-platform scenario provided by embodiments of this disclosure;
[0037] Figure 3 A flowchart illustrating yet another resource preloading method in a cross-platform scenario provided by embodiments of this disclosure;
[0038] Figure 4 This is a schematic diagram of the structure of a resource preloading device in a cross-platform scenario provided by an embodiment of the present disclosure;
[0039] Figure 5 This is a schematic diagram of the structure of a resource preloading device in a cross-platform scenario provided by an embodiment of this disclosure. Detailed Implementation
[0040] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0041] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0042] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0043] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0044] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0045] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0046] In one application scenario, when a user triggers a swipe operation on a resource card displayed in a list, how to reduce the initial screen time of subsequent resource cards that need to be displayed in the list so that they can be quickly displayed when triggered is a technical problem that needs to be solved.
[0047] To address this, this disclosure provides a resource preloading method for cross-platform scenarios. Specifically, in response to a preloading request for a target resource card, resource data of the target resource card is obtained and stored in a cache pool. The target resource card is used to display in a target list generated based on client-side code. The target resource card is generated based on front-end code. Then, a first sub-thread is called to read the resource data of the target resource card from the cache pool, driving the rendering module generated based on client-side code to pre-render the target resource card. The pre-rendered result of the target resource card is stored in the cache pool for display in the target list. A second sub-thread is called for the target resource card, whereby the second sub-thread is used to perform interactive event binding and request data updates for the target resource card.
[0048] After receiving a preloading request, this embodiment of the present disclosure pauses the call to the second sub-thread used for executing interactive event binding and requesting updated data during the process of calling the first sub-thread to drive the rendering module to pre-render the target resource card. This ensures the performance requirements of pre-rendering, improves the preloading efficiency of resource cards in cross-platform scenarios, reduces the first-screen time of resource cards, and enhances the user's browsing experience.
[0049] Based on this, the present disclosure provides a resource preloading method in a cross-platform scenario, and the method is described below with reference to specific embodiments.
[0050] Figure 1 This is a flowchart illustrating a resource preloading method in a cross-platform scenario provided by an embodiment of this disclosure. This method can be executed by a resource preloading device in a cross-platform scenario, wherein the device can be implemented in software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes:
[0051] S101: In response to a preload request for a target resource card, obtain the resource data of the target resource card and store it in the cache pool.
[0052] The target resource card is used to display in the target list generated based on client-side code, and the target resource card is generated based on front-end code.
[0053] The resource preloading addition method in the cross-platform scenario provided in this disclosure is specifically applied to the cross-platform scenario between the client and the front-end, that is, to display resource cards on the page through the interaction and collaboration between the client code and the front-end code.
[0054] The target resource card in this embodiment may include any resource card, which is generated by front-end code development, such as by JavaScript code. By displaying the target resource card, relevant media content can be viewed.
[0055] This target resource card belongs to the media resource streams displayed in the target list. This target list is generated by the client code and may include a session list and a message list. The session list is a list that displays session records.
[0056] In one application scenario, the target list can be a list of conversations between the current user and any contact. This list of conversations includes resource cards, which can be resource cards sent by the contact to the current user, or resource cards sent by the current user to the contact, etc.
[0057] In this embodiment of the disclosure, when a preloading request for a target resource card is received, the resource data of the target resource card is obtained and stored in a cache pool. This resource data may include resources related to the target resource card, specifically, the resource data may include images, text content, and other data. The cache pool is an area used to store data, facilitating subsequent fast access.
[0058] The method of obtaining resource data of the target resource card can be to pull the resource data of the target resource card from the server. The specific implementation method of pulling resource data is not limited in this embodiment.
[0059] In practical applications, the target resource card is preloaded. This embodiment of the disclosure also needs to clarify the timing of the preloading of the target resource card.
[0060] In one optional implementation, when a swipe operation is received for the target list, the target resource card is determined from the media resource stream of the target list based on the swipe direction of the swipe operation and the resource card currently displayed in the target list, and a preload request for the target resource card is triggered, thereby preloading the target resource card.
[0061] Specifically, the target resource card is determined from the media resource stream of the target list. The target resource card can be a resource card other than the currently displayed resource card. Specifically, it can be determined based on the display progress of the resource cards in the media resource stream, the display order of the currently displayed resource cards, and the sliding direction. The resource card in the display order adjacent to the current display order can be used as the target resource card. For example, the resource cards in the first n display orders of the current display order can be determined as the target resource card, or the resource cards in the last n display orders of the current display order can be used as the target resource card, where n is not less than 1.
[0062] For example, suppose there are 5 resource cards in the media resource stream, and their display order is 1-5. When the target list is first triggered, the resource card displayed in the target list is the resource card with the first display order. When the target list is triggered to slide down, the resource cards with the second to fourth display order can be identified as target resource cards based on the sliding direction.
[0063] In practical applications, target resource cards can also be preloaded when the target list is not scrolled. Since system performance consumption is low when the target list is unscrolled, preloading of resource cards can be performed in this state. Specifically, when it is detected that the target list is not scrolling, the target resource cards are determined from the media resource stream of the target list based on the display progress of the resource cards, and a preloading request for the target resource cards is triggered. The target list being in an unscrolled state can include the initial entry into the target list's display page.
[0064] Since the target list is currently not scrolling, the target resource card can be determined based on the display progress of the resource cards in the media resource stream and the display order of the resource cards currently displayed in the target list.
[0065] For example, suppose there are 5 resource cards in the media resource stream. When the target list is not scrolling, based on the display progress of the resource cards in the media resource stream of the current target list, it can be known that the 3rd resource card is displayed in the current target list. Then, according to the display order of the current resource cards, the resource cards displayed in the order of 1-2 and 4-5 can be identified as target resource cards.
[0066] In practical applications, since the size of the cache pool is limited, the embodiments of this disclosure can limit the number of preloaded resource cards. Specifically, the number of resource cards to be preloaded can be determined based on the current size of the cache pool. When the number of resource cards in the cache pool is insufficient, if the system is in a relatively idle state, the preloading of the target resource card can be triggered.
[0067] S102: Call the first sub-thread to read the resource data of the target resource card from the cache pool, drive the rendering module generated based on the client code to pre-render the target resource card, and store the pre-rendering result of the target resource card in the cache pool for display in the target list.
[0068] The first sub-thread is used to perform pre-rendering. This first sub-thread may include a JavaScript thread. Based on the resource data of the target resource card read from the cache pool, the first sub-thread drives the rendering module to pre-render the target resource card. In other words, the first sub-thread drives the rendering module to render using the resource data of the target resource card, converting the resource data of the target resource card into visual elements.
[0069] The pre-rendered result of the target resource card is stored in the cache pool so that when the target resource card is actually displayed, the pre-rendered result of the target resource card can be directly retrieved from the cache pool to achieve the effect of fast display on the first screen.
[0070] S103: Pause the invocation of the second sub-thread for the target resource card; wherein, the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
[0071] This second sub-thread can be a JavaScript thread, and it differs from the first sub-thread. This second sub-thread is used to bind interactive events to the target resource card and request data updates. Binding interactive events to the target resource card involves establishing a binding relationship between the interactive event code and the target resource card. When the user triggers an interactive action on the target resource card, the corresponding interactive event can be executed. Interactive events can include clicks, touches on the target resource card, etc.
[0072] Requesting an update for a target resource card can mean requesting the latest data for that target resource card. Specifically, this can involve sending a network request to the backend server to retrieve the latest data for the target resource card.
[0073] The resource preloading method in a cross-platform scenario provided in this disclosure responds to a preloading request for a target resource card by acquiring the resource data of the target resource card and storing it in a cache pool. The target resource card is used to display in a target list generated based on client-side code. The target resource card is generated based on front-end code. Then, a first sub-thread is called to read the resource data of the target resource card from the cache pool, driving the rendering module generated based on client-side code to pre-render the target resource card. The pre-rendered result of the target resource card is stored in the cache pool for display in the target list. A second sub-thread is called for the target resource card, and the second sub-thread is used to perform interactive event binding and request data updates for the target resource card.
[0074] After receiving a preloading request, this embodiment of the present disclosure pauses the call to the second sub-thread used for executing interactive event binding and requesting updated data during the process of calling the first sub-thread to drive the rendering module to pre-render the target resource card. This ensures the performance requirements of pre-rendering, improves the preloading efficiency of resource cards in cross-platform scenarios, reduces the first-screen time of resource cards, and enhances the user's browsing experience.
[0075] In practical applications, to facilitate understanding of the resource preloading method in cross-platform scenarios provided by the embodiments of this disclosure, this disclosure further provides a resource preloading method in cross-platform scenarios. The method will be described below with reference to specific embodiments. For example... Figure 2 As shown, the method includes:
[0076] S201: In response to a preload request for a target resource card, obtain the resource data of the target resource card and store it in the cache pool.
[0077] The target resource card is used to display in the target list generated based on client-side code, and the target resource card is generated based on front-end code.
[0078] S202: Call the first sub-thread to read the resource data of the target resource card from the cache pool, drive the rendering module generated based on the client code to pre-render the target resource card, and store the pre-rendering result of the target resource card in the cache pool for display in the target list.
[0079] S203: Pause the invocation of the second sub-thread for the target resource card; wherein, the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
[0080] The contents of S201-S203 can be understood by referring to the above embodiments, and will not be repeated here.
[0081] S204: Based on the pre-rendering results of the target resource card, display the target resource card in the target list.
[0082] In this embodiment of the disclosure, when a target resource card is detected to be displayed in the target list, the pre-rendering result of the target resource card is obtained from the cache pool, and the target resource card is displayed in the target list based on the pre-rendering result.
[0083] In other words, when the target resource card is displayed on the screen, the target resource card is displayed on the first screen based on the pre-rendered results, thereby achieving the effect of fast first-screen display.
[0084] S205: In response to the target resource card being displayed in the target list, the second sub-thread is started to perform interactive event binding and request data update for the target resource card.
[0085] When a pre-rendered result display of a target resource card is detected, to support interactive operations on the target resource card, this embodiment of the disclosure will start a second sub-thread to bind the corresponding interactive events to the target resource card. That is, a binding relationship is established between the interactive event processing code and the target resource card. When the user triggers an interactive operation on the target resource card, the corresponding interactive event can be executed. This interactive event can include events such as clicking or touching the target resource card.
[0086] In addition, when the target resource card is detected to be displayed based on the pre-rendered result, in order to allow the user to see the latest content of the target resource card, this embodiment of the disclosure starts a second sub-thread to perform a request to update data for the target resource card, so as to determine whether the target resource card needs to be updated.
[0087] S206: In response to the request to update data for the target resource card, obtain the return data for the target resource card.
[0088] Specifically, for the method of requesting data updates for the target resource card, the target resource card can be updated through a network request. In particular, the second sub-thread can send a network request to the backend server, and the backend server returns data to the second sub-thread, which may include the latest data of the target resource card.
[0089] S207: If it is determined based on the returned data that the target resource card needs to be updated, the second sub-thread drives the first sub-thread to re-render the target resource card based on the returned data of the target resource card, and updates the target resource card in the target list based on the re-rendering result.
[0090] In this embodiment of the present disclosure, when a target resource card is detected to be displayed, a second sub-thread is started to request data updates, receive returned data, determine whether the target resource card has data updates based on the returned data, and when it is determined that there are data updates, the second sub-thread drives the first sub-thread to re-render the target resource card based on the returned data, and updates the target resource card based on the re-rendering result.
[0091] In another optional implementation, when a request to update data for a target resource card is received, the return data for the target resource card is obtained. Based on the return data, it is determined whether the target resource card has update data. If it is determined that the target resource card does not have update data, the result is displayed based on the pre-rendered result of the target resource card.
[0092] To facilitate understanding of the resource preloading method in cross-platform scenarios provided in this disclosure, this disclosure further provides a resource preloading method in cross-platform scenarios, which will be described below with reference to specific embodiments. For example... Figure 3 As shown, the method includes:
[0093] S301: In response to a preload request for a target resource card, obtain the resource data of the target resource card and store it in the cache pool.
[0094] The target resource card is used to display in the target list generated based on client-side code, and the target resource card is generated based on front-end code.
[0095] S302: Call the first sub-thread to read the resource data of the target resource card from the cache pool, drive the rendering module generated based on the client code to pre-render the target resource card, and store the pre-rendering result of the target resource card in the cache pool for display in the target list.
[0096] S303: Pause the invocation of the second sub-thread for the target resource card; wherein, the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
[0097] S304: Based on the pre-rendering results of the target resource card, display the target resource card in the target list.
[0098] S305: In response to the target resource card being displayed in the target list, the second sub-thread is started to perform interactive event binding and request data update for the target resource card.
[0099] The contents of S301-S305 can be understood by referring to the above embodiments, and will not be repeated here.
[0100] S306: In response to the target resource card being removed from the target list, the second sub-thread is paused for the target resource card to suspend the execution of interactive event binding and data update requests for the target resource card.
[0101] In this embodiment of the disclosure, the removal of the target resource card from the target list can refer to the removal of the target resource card from the screen.
[0102] In practical applications, when displaying a target resource card in the target list, if it is detected that the target resource card has exited the display, there is no need to perform interactive event binding and data update requests for that target resource card. Therefore, this embodiment of the present disclosure can pause the call to the second sub-thread when it is detected that the target resource card has exited the display, thereby pausing the execution of interactive event binding and data update requests for that target resource card, thus saving this part of the performance and allocating more performance to other tasks such as the preloading operation of other resource cards.
[0103] In addition, after starting the second sub-thread to execute the request data update and determining that the target resource card has updated data based on the returned data, the second sub-thread can be paused when the target resource card is detected to be exiting the display, so as to stop updating the target resource card and reduce performance consumption.
[0104] In one optional implementation, when a swipe operation is received for the target list, it is determined whether the target resource card has been removed from the target list. If the target resource card is detected to have been removed from the target list, the second sub-thread is paused to stop the execution of interactive event binding and data update requests for the target resource card, so as to save performance.
[0105] To achieve the above embodiments, this disclosure also proposes a resource preloading device for cross-platform scenarios. Figure 4 This is a schematic diagram of a resource preloading device for a cross-platform scenario provided by an embodiment of this disclosure. The device can be implemented by software and / or hardware, and is generally integrated into an electronic device. Figure 4 As shown, the device includes:
[0106] The first acquisition module 401 is used to acquire the resource data of the target resource card and store it in a cache pool in response to a preloading request for the target resource card; wherein the target resource card is used to display in a target list generated based on client code, and the target resource card is generated based on front-end code;
[0107] The first rendering module 402 is used to call the first sub-thread to read the resource data of the target resource card from the cache pool, drive the rendering module generated based on the client code to pre-render the target resource card, and store the pre-rendering result of the target resource card into the cache pool for display in the target list;
[0108] The first pause module 403 is used to pause the invocation of the second sub-thread for the target resource card; wherein, the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
[0109] In one optional embodiment, the apparatus further includes:
[0110] The display module is used to display the target resource card in the target list based on the pre-rendered result of the target resource card;
[0111] The startup module is used to start the second sub-thread in response to the display of the target resource card in the target list, so as to perform interactive event binding and request data update for the target resource card.
[0112] In one optional embodiment, the apparatus further includes:
[0113] The second acquisition module is used to acquire the return data for the target resource card in response to the request to update data for the target resource card;
[0114] The second rendering module is used to, if it is determined from the returned data that the target resource card has an update requirement, drive the first sub-thread to re-render the target resource card based on the returned data of the target resource card, and update the target resource card in the target list based on the re-rendering result.
[0115] In one optional embodiment, the apparatus further includes:
[0116] The second pause module is used to pause the invocation of the second sub-thread for the target resource card in response to the target resource card being removed from the target list, so as to pause the execution of interactive event binding and request for data update for the target resource card.
[0117] In one optional embodiment, the apparatus further includes:
[0118] The first determining module is used to determine, in response to a sliding operation on the target list, whether the target resource card is removed from the target list.
[0119] In one optional embodiment, the apparatus further includes:
[0120] The second determining module is configured to, in response to a sliding operation on the target list, determine a target resource card from the media resource stream of the target list based on the sliding direction of the sliding operation, and trigger a preloading request for the target resource card; wherein the media resource stream includes resource cards for displaying in the target list.
[0121] In one optional embodiment, the apparatus further includes:
[0122] The third determining module is configured to, in response to the target list not being scrolled, determine a target resource card from the media resource stream of the target list and trigger a preloading request for the target resource card; wherein the media resource stream includes resource cards for display in the target list.
[0123] In the cross-platform resource preloading device provided in this embodiment, in response to a preloading request for a target resource card, the resource data of the target resource card is obtained and stored in a cache pool. The target resource card is used to display in a target list generated based on client code. The target resource card is generated based on front-end code. Then, a first sub-thread is called to read the resource data of the target resource card from the cache pool, drive the rendering module generated based on client code to pre-render the target resource card, and store the pre-rendered result of the target resource card in the cache pool for display in the target list. The second sub-thread is called for the target resource card, and the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
[0124] After receiving a preloading request, this embodiment of the present disclosure pauses the call to the second sub-thread used for executing interactive event binding and requesting updated data during the process of calling the first sub-thread to drive the rendering module to pre-render the target resource card. This ensures the performance requirements of pre-rendering, improves the preloading efficiency of resource cards in cross-platform scenarios, reduces the first-screen time of resource cards, and enhances the user's browsing experience.
[0125] The resource preloading device for cross-platform scenarios provided in this disclosure can execute the resource preloading method for cross-platform scenarios provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0126] To implement the above embodiments, this disclosure also proposes a computer program product, including a computer program / instruction, which, when executed by a processor, implements the resource preloading method in the cross-platform scenario described in the above embodiments.
[0127] In addition, this disclosure also provides a resource preloading device for cross-platform scenarios, see [link to relevant documentation]. Figure 5 As shown, it may include:
[0128] The data synchronization device includes a processor 501, a memory 502, an input device 503, and an output device 504. The number of processors 501 in the data synchronization device can be one or more. Figure 5 Taking a processor as an example. In some embodiments of this disclosure, the processor 501, memory 502, input device 503, and output device 504 can be connected via a bus or other means, wherein, Figure 5 Taking the example of a connection between China and Israel via a bus.
[0129] The memory 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing of the data synchronization device by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc. In addition, the memory 502 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. The input device 503 can be used to receive input digital or character information, and to generate signal inputs related to user settings and function control of the data synchronization device.
[0130] Specifically in this embodiment, the processor 501 will load the executable files corresponding to the processes of one or more applications into the memory 502 according to the following instructions, and the processor 501 will run the applications stored in the memory 502 to realize the various functions of the above-mentioned data synchronization device.
[0131] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0132] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A resource preloading method for cross-platform scenarios, characterized in that, include: In response to a preload request for a target resource card, the resource data of the target resource card is obtained and stored in a cache pool; wherein, the target resource card is used to display in a target list generated based on client-side code, and the target resource card is generated based on front-end code; The first sub-thread is invoked to read the resource data of the target resource card from the cache pool, and the rendering module generated based on the client code is driven to pre-render the target resource card. The pre-rendering result of the target resource card is stored in the cache pool for display in the target list. The second sub-thread is paused for the target resource card; wherein the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
2. The method according to claim 1, characterized in that, The method further includes: Based on the pre-rendered results of the target resource card, the target resource card is displayed in the target list; In response to the target resource card being displayed in the target list, the second sub-thread is started to perform interactive event binding and request data updates for the target resource card.
3. The method according to claim 2, characterized in that, The method further includes: In response to a request to update data for the target resource card, return data for the target resource card is obtained; If it is determined based on the returned data that the target resource card needs to be updated, the second sub-thread drives the first sub-thread to re-render the target resource card based on the returned data of the target resource card, and updates the target resource card in the target list based on the re-rendering result.
4. The method according to claim 2, characterized in that, In response to the display of the target resource card, after starting the second sub-thread to perform interactive event binding and request data update for the target resource card, the process further includes: In response to the target resource card being removed from the target list, the second sub-thread is paused for the target resource card to suspend the execution of interactive event binding and data update requests for the target resource card.
5. The method according to claim 4, characterized in that, The step of pausing the invocation of the second sub-thread for the target resource card in response to the target resource card being removed from the target list, before pausing the execution of interactive event binding and data update requests for the target resource card, further includes: In response to a swipe operation on the target list, determine whether the target resource card should be removed from the target list.
6. The method according to claim 1, characterized in that, Before responding to a preloading request for a target resource card, obtaining the resource data of the target resource card, and storing it in the cache pool, the method further includes: In response to a swipe operation on the target list, a target resource card is determined from the media resource stream of the target list based on the swipe direction of the swipe operation, and a preload request for the target resource card is triggered; wherein the media resource stream includes resource cards for display in the target list.
7. The method according to claim 1, characterized in that, Before responding to a preloading request for a target resource card, obtaining the resource data of the target resource card, and storing it in the cache pool, the method further includes: In response to the target list not being scrolled, a target resource card is determined from the media resource stream of the target list, and a preload request for the target resource card is triggered; wherein the media resource stream includes resource cards for display in the target list.
8. A resource preloading device for cross-platform scenarios, characterized in that, The device includes: The first acquisition module is used to respond to a preloading request for a target resource card, acquire the resource data of the target resource card and store it in a cache pool; wherein, the target resource card is used to display in a target list generated based on client code, and the target resource card is generated based on front-end code; The first rendering module is used to call the first sub-thread to read the resource data of the target resource card from the cache pool, drive the rendering module generated based on the client code to pre-render the target resource card, and store the pre-rendered result of the target resource card into the cache pool for display in the target list. The first pause module is used to pause the invocation of the second sub-thread for the target resource card; wherein, the second sub-thread is used to perform interactive event binding and request data update for the target resource card.
9. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the resource preloading method in a cross-platform scenario as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which is used to execute the resource preloading method in the cross-platform scenario as described in any one of claims 1-7.
11. A computer program product, characterized in that, The computer program product includes a computer program / instruction that, when executed by a processor, implements the method as described in any one of claims 1-7.