Application intelligent refresh methods, devices, computer equipment, and storage media
By generating a wrapper component that depends on the source data, listening for changes in the source data and performing a partial refresh, the problem of long processing time in traditional methods is solved, and the efficiency of component refresh is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN OURUIBO ELECTRONICS
- Filing Date
- 2022-12-30
- Publication Date
- 2026-06-30
Smart Images

Figure CN116302026B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a method, apparatus, computer device, and storage medium for intelligent application refresh. Background Technology
[0002] With the continuous development of technology, the number of applications has also increased. During the operation of an application, the source data associated with the application may also change continuously. At this time, a situation may occur where the source data and the application are out of sync. Therefore, it is necessary to synchronize and refresh the different components of the application to achieve data synchronization.
[0003] In traditional methods, when the application's source data changes, all components in the application need to be parsed and refreshed again. However, this component refresh method is time-consuming, thus affecting the efficiency of component refresh. Summary of the Invention
[0004] Therefore, it is necessary to provide an application intelligent refresh method, apparatus, computer device, and storage medium that can improve component refresh efficiency in response to the above-mentioned technical problems.
[0005] In a first aspect, this application provides a method for intelligent application refresh, the method comprising:
[0006] Listen for changes to the application's source data through the application's wrapper components; the wrapper components are generated by binding specified components of the application to multiple specified fields in the source data; each instantiated object of the wrapper component corresponds to at least some of the specified fields;
[0007] When a change is detected in the application's source data, for each instantiated object of the wrapper component, data related to the specified field corresponding to the instantiated object is extracted from the changed data to obtain the target data corresponding to the instantiated object.
[0008] Based on the target data corresponding to multiple instantiated objects, determine the instantiated objects that need to be refreshed to obtain the target refresh object, and perform refresh operations on the target refresh object.
[0009] In some embodiments, before listening for changes in the application's source data via the application's wrapper component, the method further includes:
[0010] The abstract syntax tree is obtained by transforming the source code of the application's application pages; the application pages are obtained by editing multiple wrapper components of the application.
[0011] The abstract syntax tree is parsed to obtain multiple wrapper components loaded by the application.
[0012] In some embodiments, the steps of parsing the abstract syntax tree to obtain multiple wrapper components loaded by the application specifically include:
[0013] The abstract syntax tree is parsed to obtain the multiple components loaded by the application;
[0014] Based on the component names and component types corresponding to multiple components, determine the multiple wrapper components loaded by the application from among the multiple components.
[0015] In some embodiments, after parsing the abstract syntax tree to obtain multiple wrapper components loaded by the application, the method further includes:
[0016] Render the multiple parsed wrapper components and generate multiple instantiated objects corresponding to each wrapper component;
[0017] Register the multiple instantiated objects corresponding to each wrapper component into the respective cache of each wrapper component.
[0018] In some embodiments, when a change is detected in the application's source data, for each instantiated object of the wrapper component, data related to a specified field corresponding to the instantiated object is extracted from the changed data to obtain the target data corresponding to the instantiated object. The specific steps include:
[0019] When a change is detected in the application's source data, the cache corresponding to the wrapper component is notified to perform object traversal processing.
[0020] For each instantiated object encountered during the iteration, extract data related to the specified fields corresponding to the instantiated object from the changed data to obtain the target data corresponding to the instantiated object.
[0021] In some embodiments, the step of determining the instantiated object to be refreshed based on the target data corresponding to multiple instantiated objects to obtain the target refresh object specifically includes:
[0022] For each instantiated object, the field value corresponding to the specified field of the instantiated object is compared with the target data. If the target data and the field value are different, the instantiated object is determined as the target refresh object.
[0023] In some embodiments, the steps of performing a refresh operation on the target refresh object specifically include:
[0024] Update the value of a specified field in the target refresh object based on the target data corresponding to the target refresh object;
[0025] The target refresh object is rendered based on the updated field values to achieve partial refresh of the wrapper component.
[0026] Secondly, this application provides an application intelligent refresh device, the device comprising:
[0027] The listening module is used to listen for changes in the application's source data through the application's wrapper components; the wrapper components are generated by binding specified components of the application to multiple specified fields in the source data; each instantiated object of the wrapper component corresponds to at least some of the specified fields;
[0028] The extraction module is used to extract data related to specified fields corresponding to the instantiated objects from the changed data for each instantiated object of the wrapper component when the source data of the application is detected to change, so as to obtain the target data corresponding to the instantiated objects.
[0029] The refresh module is used to determine the instantiated object that needs to be refreshed based on the target data corresponding to multiple instantiated objects, and then perform a refresh operation on the target refresh object.
[0030] In some embodiments, the application intelligent refresh device further includes a parsing module, which is used to determine the abstract syntax tree obtained by converting the program source code of the application page of the application; the application page is obtained by editing multiple wrapper components of the application; and the abstract syntax tree is parsed to obtain multiple wrapper components loaded by the application.
[0031] In some embodiments, the parsing module is further configured to parse the abstract syntax tree to obtain multiple components loaded by the application; and to determine multiple wrapper components loaded by the application from the multiple components based on the component names and component types corresponding to the multiple components.
[0032] In some embodiments, the application smart refresh device further includes a registration module, which is used to render the parsed multiple wrapper components, generate multiple instantiated objects corresponding to each wrapper component, and register the multiple instantiated objects corresponding to each wrapper component into the cache corresponding to each wrapper component.
[0033] In some embodiments, the extraction module is further configured to, when a change is detected in the source data of the application, notify the cache corresponding to the wrapper component to perform object traversal processing; for each instantiated object traversed, extract data related to a specified field corresponding to the instantiated object from the changed data to obtain the target data corresponding to the instantiated object.
[0034] In some embodiments, the refresh module is further configured to compare the field value corresponding to a specified field of each instantiated object with the target data, and if the target data and the field value are different, determine the instantiated object as the target refresh object.
[0035] In some embodiments, the refresh module is further configured to update the field value of a specified field of the target refresh object according to the target data corresponding to the target refresh object; and render the target refresh object based on the updated field value to achieve partial refresh of the wrapper component.
[0036] Thirdly, this application provides a computing device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described intelligent application refresh method.
[0037] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described application intelligent refresh method.
[0038] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps in the above-described intelligent application refresh method.
[0039] The aforementioned application intelligent refresh method, apparatus, computer device, storage medium, and computer program product generate a wrapper component that depends on the source data by binding specified components in the application to multiple specified fields in the source data. The wrapper component monitors changes in the application's source data; each instantiated object of the wrapper component corresponds to at least some of the specified fields. When the wrapper component detects a change in the application's source data, for each instantiated object of the wrapper component, it extracts data related to the specified fields corresponding to the instantiated object from the changed data to obtain the target data corresponding to the instantiated object. Based on the target data corresponding to multiple instantiated objects, it determines the instantiated objects that need to be refreshed to obtain the target refresh objects, and performs a refresh operation only on the target refresh objects in the wrapper component, achieving partial refresh of the wrapper component to reduce refresh time and improve component refresh efficiency. Attached Figure Description
[0040] Figure 1 A flowchart illustrating an application intelligent refresh method provided in this application embodiment;
[0041] Figure 2 A flowchart illustrating another application intelligent refresh method provided in this application embodiment;
[0042] Figure 3 A flowchart illustrating another application intelligent refresh method provided in this application embodiment;
[0043] Figure 4 This is a schematic diagram of the structure of an application intelligent refresh device provided in an embodiment of this application;
[0044] Figure 5 An internal structural diagram of a computer device provided in an embodiment of this application;
[0045] Figure 6 This is an internal structural diagram of another computer device provided in an embodiment of this application. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0047] In some embodiments, such as Figure 1 As shown, an application intelligent refresh method is provided. This embodiment illustrates the method by applying it to a computer device. It is understood that the computer device can be a server or a terminal. The method can be implemented by the server or the terminal alone, or it can be implemented through interaction between the server and the terminal. In this embodiment, the method includes, but is not limited to, the following steps:
[0048] Step 102: Monitor changes in the application's source data through the application's wrapper component.
[0049] An application program refers to a computer program designed to perform one or more specific tasks. It runs in user mode, can interact with the user, and has a visual user interface.
[0050] In some embodiments, the application may specifically be a Flutter application. Flutter is an open-source toolkit for building user interfaces that helps developers efficiently build beautiful, multi-platform applications using a single codebase, supporting mobile, web, desktop, and embedded platforms. In essence, a Flutter application is an application developed using Flutter.
[0051] Source data refers to the basic data unified by the underlying framework and required for the application to run. For example, if the main function of the application is to control the device status of smart devices, then the source data of the application can be the device status and device attributes of the smart devices that need to be controlled.
[0052] A wrapper component is a component created by binding a specified component of the application to multiple specified fields in the source data. Each instantiated object of the wrapper component corresponds to at least some of the specified fields. In other words, a specified component of the application can be bound to a specified field in the source data to generate a corresponding wrapper component, and a specified component of the application can also be bound to multiple specified fields in the source data to generate corresponding wrapper components. It should be noted that wrapper components can also provide caching and conditional logic, while other components in the application only have display functionality.
[0053] In some embodiments, the specified component of the application includes a Widget component in the Flutter application. A Widget component is a structured description of a view in a Flutter application; it can be viewed as a control or component in the front end. Furthermore, a Widget is the basic logical unit of component implementation, storing configuration information related to view rendering, including at least one of layout, rendering properties, or event response information. It should be noted that a Widget component includes at least one of text components, button components, or list components.
[0054] In some embodiments, a specified field in the source data refers to an attribute field that reflects the device state of the smart device to be controlled. This specified field has at least one field value, which is the specific device state of the smart device to be controlled. For example, the specified field may be "Device On / Off Status", and the field value corresponding to this specified field may be "On" or "Off", indicating whether the corresponding smart device is in an on or off state.
[0055] Specifically, the computer device listens to the application's source data through a pre-defined wrapper component to determine if the source data has changed. It can be understood that when the wrapper component detects a change in the application's source data, it indicates that a component refresh may be necessary; conversely, when the wrapper component does not detect a change, it indicates that a component refresh is not required.
[0056] Step 104: When the source data of the application is detected to have changed, for each instantiated object of the wrapper component, extract the data related to the specified field corresponding to the instantiated object from the changed data to obtain the target data corresponding to the instantiated object.
[0057] In this context, an instantiated object refers to the object that actually represents the element displayed on the screen. The instantiated object carries the context data for view construction and serves as a bridge connecting structured configuration information to the final rendering.
[0058] In some embodiments, the instantiated object includes an Element object in the Flutter application. Here, an Element object refers to an instantiated object within a Widget component. It can be understood that the class that actually represents the element displayed on the screen in the Flutter application is the Element object, and the Widget component merely describes the configuration data of the Element object. It should be noted that a Widget component can correspond to one Element object or multiple Element objects.
[0059] Specifically, when a computer device detects a change in the application's source data through the application's wrapper component, the computer device extracts data related to a specified field corresponding to that instantiated object from the changed source data for each instantiated object corresponding to the wrapper component, in order to obtain the target data corresponding to that instantiated object.
[0060] For example, suppose a specified field of a certain instantiated object corresponding to the packaging component is the device temperature of the smart device that needs to be controlled. Then the computer device extracts data related to the device temperature from the changed source data to obtain the target data corresponding to the instantiated object.
[0061] Step 106: Based on the target data corresponding to the multiple instantiated objects, determine the instantiated objects that need to be refreshed to obtain the target refresh object, and perform a refresh operation on the target refresh object.
[0062] Specifically, the computer device compares the target data corresponding to multiple instantiated objects with the field values of their respective specified fields. If the target data causes a change in the field value, it indicates that the instantiated object corresponding to the target data is the one that needs to be refreshed. The computer device determines the instantiated object that needs to be refreshed from the multiple instantiated objects, obtains the target refresh object, and performs the refresh operation only on the target refresh object; the remaining instantiated objects do not need to be refreshed.
[0063] It is understandable that when the target refresh object is all instantiated objects corresponding to the application, then all objects in the application need to be refreshed; when the target refresh object is a subset of instantiated objects corresponding to the application, then the target refresh object in the application needs to be refreshed.
[0064] The aforementioned intelligent refresh method for applications binds specified components within the application to multiple specified fields in the source data to generate wrapper components that depend on the source data. These wrapper components monitor changes in the application's source data; each instantiated object of the wrapper component corresponds to at least some of the specified fields. When the wrapper component detects a change in the application's source data, for each instantiated object, it extracts data related to the specified fields corresponding to the instantiated object from the changed data to obtain the target data for that instantiated object. Based on the target data corresponding to multiple instantiated objects, it determines the instantiated objects that need to be refreshed to obtain the target refresh objects. A refresh operation is then performed only on the target refresh objects within the wrapper components, achieving partial refresh of the wrapper components to reduce refresh time and improve component refresh efficiency.
[0065] In some embodiments, prior to step 102, the application intelligent refresh method of this application further includes, but is not limited to, the steps of: determining the abstract syntax tree obtained by converting the application source code of the application page; and parsing the abstract syntax tree to obtain multiple wrapper components loaded by the application.
[0066] The application page is created by editing multiple wrapper components of the application. In other words, after creating multiple wrapper components, developers can use the corresponding components to edit the application pages according to their specific needs, resulting in the final application page. The program source code refers to the application's source code, which is a series of human-readable computer language instructions.
[0067] In computer science, an Abstract Syntax Tree (AST) is an abstract representation of the syntactic structure of source code. It represents the syntactic structure of a programming language in a tree-like form, with each node in the tree representing a structure in the source code.
[0068] Specifically, the computer device acquires the edited application page from the application and performs lexical and syntactic analysis on the program source code of the application page to convert the program source code into a corresponding abstract syntax tree. This application, by converting the program source code into an abstract syntax tree, can retain more syntactic information and reduce data redundancy. Furthermore, the computer device parses the abstract syntax tree to obtain multiple wrapper components loaded by the application.
[0069] In some embodiments, a computer device can convert the application page's source code into a JSON (JavaScript Object Notation) string of a certain format according to a preset parsing specification to obtain the corresponding abstract syntax tree. Here, JSON refers to a lightweight data interchange format, and a JSON string refers to a string that conforms to JSON format requirements.
[0070] In some embodiments, the step "parse the abstract syntax tree to obtain multiple wrapper components loaded by the application" specifically includes, but is not limited to, the steps of: parsing the abstract syntax tree to obtain multiple components loaded by the application; and determining the multiple wrapper components loaded by the application from the multiple components based on the component names and component types corresponding to the multiple components.
[0071] Specifically, the component name and type of the wrapper component are generally different from those of other components in the application. Therefore, the computer device can first parse the abstract syntax tree to obtain all the components loaded by the application, and then filter all the components loaded by the application according to the component name and component type to determine the corresponding multiple wrapper components from all the components loaded by the application. Thus, the refresh decision is only made for these multiple wrapper components, improving the efficiency of component refresh.
[0072] In some embodiments, the loaded abstract syntax tree can be parsed and processed by a user interface (UI) engine to obtain multiple wrapper components loaded by the application. Here, the user interface engine refers to middleware for developing graphical application software, and is also a solution oriented towards interaction design, offering faster development and modification response speeds, higher portability, and superior performance.
[0073] In some embodiments, after the step of "parse the abstract syntax tree to obtain multiple wrapper components loaded by the application", the application intelligent refresh method of this application further includes, but is not limited to, the steps of: rendering the parsed multiple wrapper components to generate multiple instantiated objects corresponding to each wrapper component; and registering the multiple instantiated objects corresponding to each wrapper component to the cache corresponding to each wrapper component.
[0074] The cache is used to cache multiple instantiated objects corresponding to each wrapper component. It should be noted that there is a one-to-one correspondence between wrapper components and caches, that is, a certain cache is only responsible for caching the instantiated objects of its corresponding wrapper component.
[0075] Specifically, the computer device renders multiple wrapper components obtained from parsing the abstract syntax tree, resulting in multiple instantiated objects corresponding to each wrapper component. Then, the computer device registers each of these instantiated objects with its own corresponding cache. This cache allows the wrapper component to retrieve the cached data of each instantiated object when it detects a change in the application's data source, compares it with the data source, and determines whether the instantiated objects need to be refreshed.
[0076] For example, suppose the wrapper components parsed by the abstract syntax tree include wrapper component A and wrapper component B, and the cache corresponding to wrapper component A is cache A, and the cache corresponding to wrapper component B is cache B. After rendering wrapper component A, multiple instantiated objects corresponding to wrapper component A can be registered to cache A for caching. After rendering wrapper component B, multiple instantiated objects corresponding to wrapper component B can be registered to cache B for caching.
[0077] In some embodiments, step 104 specifically includes, but is not limited to, the following steps: when a change is detected in the source data of the application, the cache corresponding to the wrapper component is notified to perform object traversal processing; for each instantiated object traversed, data related to a specified field corresponding to the instantiated object is extracted from the changed data to obtain the target data corresponding to the instantiated object.
[0078] Among them, object traversal processing refers to the process of the cacher traversing all instantiated objects in its cache.
[0079] Specifically, when a computer device detects a change in the application's source data through the application's wrapper component, the wrapper component notifies its corresponding cache, causing the cache to iterate through all its pre-stored instantiated objects. For each instantiated object it iterates through, data related to a specified field corresponding to the iterated instantiated object is extracted from the changed data to obtain the target data for each instantiated object. Based on the target data, it is then determined whether each instantiated object needs to be refreshed, and the instantiated objects that need to be refreshed are identified. Compared to directly refreshing all instantiated objects, this method offers better refresh performance.
[0080] In some embodiments, step 106, "determining the instantiated object to be refreshed based on the target data corresponding to the multiple instantiated objects to obtain the target refresh object", specifically includes, but is not limited to, the following steps: for each instantiated object, comparing the field value corresponding to the specified field of the instantiated object with the target data, and determining the instantiated object as the target refresh object if the target data and the field value are different.
[0081] The target refresh object refers to the instantiated object that needs to undergo the refresh operation.
[0082] Specifically, for each instantiated object, the computer device compares the field value corresponding to a specified field of that instantiated object with the target data. If the target data and field value differ, it indicates that the target data caused a change in the field of the instantiated object, and in this case, the instantiated object needs to be identified as the target refresh object. Conversely, if the target data and field value are the same, it indicates that the target data did not cause a change in the field of the instantiated object, and a refresh operation is not required for that instantiated object. It should be noted that when the wrapper component detects a change in the data source, it can refresh only the target refresh object that needs to be refreshed, thereby improving refresh performance.
[0083] For example, if the specified field corresponding to a certain instantiated object is "device on / off status" and the corresponding field value is "on", the corresponding target data can be data that reflects the on / off status of the smart device, such as "device" and "off". Since the target data and field value are different, it means that the device on / off status has changed. At this time, a refresh operation needs to be performed on the instantiated object.
[0084] In some embodiments, the computer device may also compare the field value corresponding to a specified field of each instantiated object with the target data. If the target data and the field value are different, and this causes a change in the display of the instantiated object, then the instantiated object needs to be identified as the target object to be refreshed. It should be noted that if the target data and the field value are different, but the target data does not cause a change in the display of the instantiated object, then a refresh operation is not required for the instantiated object.
[0085] For example, if a specified field corresponding to an instantiated object is "device temperature," when the value of the "device temperature" field is less than 20 degrees, the font displayed on the application page for this instantiated object will be configured as blue. When the value of the "device temperature" field is greater than or equal to 20 degrees, the font displayed on the application page for this instantiated object will be configured as red. Suppose the original value of the "device temperature" field corresponding to this instantiated object is 15 degrees, then the font displayed within this instantiated object is blue. If the target data indicating the device temperature for this instantiated object is 23 degrees, since this temperature value is greater than 20 degrees, this will cause a change in the display of this instantiated object. In this case, a refresh operation is needed to update the font displayed within this instantiated object to red.
[0086] In some embodiments, the "perform refresh operation on the target refresh object" in step 106 includes, but is not limited to: updating the field value of a specified field of the target refresh object according to the target data corresponding to the target refresh object; and rendering the target refresh object based on the updated field value to achieve partial refresh of the wrapper component.
[0087] Specifically, the computer device updates the field values of specified fields of the target refresh object cached in the cache according to the target data of the target refresh object, and re-renders the target refresh object based on the updated field values to achieve partial refresh of the wrapper component, and makes the field values cached in the cache the state of the most recently updated state.
[0088] For example, if a specified field corresponding to a target refresh object is "device temperature," when the field value of "device temperature" is less than 20 degrees, the font displayed on the application page for the target refresh object will be configured as blue; when the field value of "device temperature" is greater than or equal to 20 degrees, the font displayed on the application interface for the target refresh object will be configured as red. Suppose the original field value of the "device temperature" for the target refresh object was 15 degrees, then the font displayed within the target refresh object would be blue. Before refreshing the target refresh object, suppose the target data indicating the device temperature is 23 degrees, then the original field value in the cache needs to be updated to 23 degrees. Since this temperature value is greater than 20 degrees, this will cause a change in the display of the target refresh object. At this point, the target refresh object needs to be rendered based on the updated temperature value so that the font displayed on the target refresh object in the application interface is updated to red.
[0089] In some embodiments, such as Figure 2As shown, the steps of registering a listener cache in this application include: the computer device obtains the abstract syntax tree of the application and parses the obtained abstract syntax tree to obtain the parsed components. If the parsed components are not bound to source data, the computer device binds the unbound components to the source data to obtain bound wrapper components, and registers these wrapper components to the cache, so that the cache can cache each instantiated object corresponding to the wrapper component and listen to each cached instantiated object.
[0090] In some embodiments, such as Figure 3 As shown, when the data source changes, the cache is notified so that it can traverse multiple stateless instantiated objects (Stateless Elements) corresponding to the Element Tree. Based on the fields of each stateless instantiated object, it determines whether the change in the source data will affect the corresponding components in the Widget Tree, such as the MyApp component, the First component, or the Container component, and refreshes the affected components. Both the Element Tree and the Component Tree are trees in the Flutter application. Stateless instantiated objects refer to classes without state; they are fixed when the application page is written and cannot be changed.
[0091] In some embodiments, the application smart refresh method of this application further includes, but is not limited to, the following steps:
[0092] (1) Determine the abstract syntax tree obtained by converting the application source code of the application page.
[0093] (2) Parse the abstract syntax tree to obtain multiple components loaded by the application.
[0094] (3) Based on the component name and component type corresponding to the multiple components, determine the multiple wrapper components loaded by the application from the multiple components.
[0095] (4) Render the multiple parsed wrapper components and generate multiple instantiated objects corresponding to each wrapper component.
[0096] (5) Register the multiple instantiated objects corresponding to each wrapper component into the respective cache of each wrapper component.
[0097] (6) Monitor changes in the application's source data through the application's wrapper components.
[0098] (7) When the source data of the application is detected to change, notify the cache corresponding to the wrapper component to perform object traversal processing.
[0099] (8) For each instantiated object traversed, extract the data related to the specified field corresponding to the instantiated object from the changed data to obtain the target data corresponding to the instantiated object.
[0100] (9) For each instantiated object, compare the field value corresponding to the specified field of the instantiated object with the target data. If the target data and the field value are different, the instantiated object is determined as the target refresh object.
[0101] (10) Update the field value of the specified field of the target refresh object according to the target data corresponding to the target refresh object.
[0102] (11) Render the target refresh object based on the updated field values to achieve partial refresh of the wrapper component.
[0103] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0104] Based on the same inventive concept, this application also provides an application intelligent refresh device for implementing the application intelligent refresh method described above. The solution provided by this system is similar to the implementation described in the above method; therefore, the specific limitations in one or more application intelligent refresh device embodiments provided below can be found in the limitations of the application intelligent refresh method described above, and will not be repeated here.
[0105] In some embodiments, such as Figure 4 As shown, an application intelligent refresh device is provided, including a listening module 402, an extraction module 404, and a refresh module 406, wherein:
[0106] Listening module 402 is used to listen for changes in the application's source data through the application's wrapper component; the wrapper component is a component generated by binding a specified component of the application to multiple specified fields in the source data; each instantiated object of the wrapper component corresponds to at least some of the specified fields;
[0107] The extraction module 404 is used to extract data related to a specified field corresponding to the instantiated object from the changed data for each instantiated object of the wrapper component when the source data of the application is detected to have changed, so as to obtain the target data corresponding to the instantiated object.
[0108] The refresh module 406 is used to determine the instantiated object that needs to be refreshed based on the target data corresponding to multiple instantiated objects, and to perform a refresh operation on the target refresh object.
[0109] The aforementioned application intelligent refresh device generates a wrapper component that depends on the source data by binding specified components in the application to multiple specified fields in the source data. The wrapper component monitors changes in the application's source data; each instantiated object of the wrapper component corresponds to at least some of the specified fields. When the wrapper component detects a change in the application's source data, for each instantiated object, it extracts data related to the specified fields corresponding to the instantiated object from the changed data to obtain the target data corresponding to the instantiated object. Based on the target data corresponding to multiple instantiated objects, it determines the instantiated objects that need to be refreshed to obtain the target refresh objects. It then performs a refresh operation only on the target refresh objects within the wrapper component, achieving partial refresh of the wrapper component to reduce refresh time and improve component refresh efficiency.
[0110] In some embodiments, the application intelligent refresh device further includes a parsing module, which is used to determine the abstract syntax tree obtained by converting the program source code of the application page of the application; the application page is obtained by editing multiple wrapper components of the application; and the abstract syntax tree is parsed to obtain multiple wrapper components loaded by the application.
[0111] In some embodiments, the parsing module is further configured to parse the abstract syntax tree to obtain multiple components loaded by the application; and to determine multiple wrapper components loaded by the application from the multiple components based on the component names and component types corresponding to the multiple components.
[0112] In some embodiments, the application smart refresh device further includes a registration module, which is used to render the parsed multiple wrapper components, generate multiple instantiated objects corresponding to each wrapper component, and register the multiple instantiated objects corresponding to each wrapper component into the cache corresponding to each wrapper component.
[0113] In some embodiments, the extraction module 404 is further configured to, when the source data of the application is detected to change, notify the cache corresponding to the wrapping component to perform object traversal processing; for each instantiated object traversed, extract data related to the specified field corresponding to the instantiated object from the changed data to obtain the target data corresponding to the instantiated object.
[0114] In some embodiments, the refresh module 406 is further configured to compare the field value corresponding to a specified field of each instantiated object with the target data, and determine the instantiated object as the target refresh object if the target data and the field value are different.
[0115] In some embodiments, the refresh module 406 is further configured to refresh the target data corresponding to the target object.
[0116] Update the value of a specified field of the target refresh object; render the target refresh object 5 based on the updated field value to achieve a partial refresh of the wrapper component.
[0117] The modules in the aforementioned application intelligent refresh device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0118] 0 In some embodiments, a computer device is provided, which may be a server.
[0119] Its internal structure diagram can be as follows Figure 5 As shown. The computer device includes a processor, memory, and network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media...
[0120] The internal memory contains an operating system, computer programs, and a database. This internal memory provides an environment for the operation of the operating system and computer programs within the non-volatile storage medium. The computer device's database stores data related to program refresh. The computer device's network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements an intelligent application refresh method.
[0121] In some embodiments, a computer device is provided, which may be a terminal.
[0122] Internal structure diagrams can be as follows Figure 6As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores...
[0123] Operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored on non-volatile storage media. The computer device's input / output interface is used for exchanging information between the processor and external devices. The computer device's communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements an application intelligent refresh method. The computer device's display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink display screen. The computer device's input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad located on the computer device's casing, or an external keyboard, touchpad, or mouse, etc.
[0124] Those skilled in the art will understand that Figure 5 and Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0125] In some embodiments, a computer device is also provided, the computer device including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps in the above method embodiments.
[0126] In some embodiments, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0127] In some embodiments, a computer program product is provided, which includes a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0128] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0129] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0130] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0131] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. An application intelligent refresh method, characterized by, The method includes: The application's source data is monitored through a wrapper component; the wrapper component is a component generated by binding specified components of the application to multiple specified fields in the source data; each instantiated object of the wrapper component corresponds to at least a portion of the specified fields; When a change is detected in the source data of the application, for each instantiated object of the wrapper component, data related to a specified field corresponding to the instantiated object is extracted from the changed data to obtain the target data corresponding to the instantiated object; For each instantiated object, the field value corresponding to the specified field of the instantiated object is compared with the target data. When the target data is different from the field value, the target data is compared with a preset threshold. When the comparison result indicates that the target data will cause the display of the corresponding instantiated object to change, the instantiated object is determined as the target refresh object, and a refresh operation is performed on the target refresh object.
2. The method according to claim 1, characterized in that, Prior to listening for changes in the application's source data via the application's wrapper component, the method further includes: An abstract syntax tree is obtained by converting the source code of the application page of the application; the application page is obtained by editing multiple wrapper components of the application. The abstract syntax tree is parsed to obtain multiple wrapper components loaded by the application.
3. The method according to claim 2, characterized in that, The step of parsing the abstract syntax tree to obtain the multiple wrapper components loaded by the application specifically includes: The abstract syntax tree is parsed to obtain multiple components loaded by the application. Based on the component names and component types corresponding to the multiple components, the multiple wrapper components loaded by the application are determined from the multiple components.
4. The method according to claim 2, characterized in that, After parsing the abstract syntax tree to obtain the multiple wrapper components loaded by the application, the method further includes: The parsed multiple wrapper components are rendered to generate multiple instantiated objects corresponding to each wrapper component; Each of the multiple instantiated objects corresponding to each of the wrapper components is registered to the respective cache of each wrapper component.
5. The method according to claim 1, characterized in that, The step of extracting data related to a specified field corresponding to the instantiated object from the changed data when a change is detected in the application's source data, to obtain the target data corresponding to the instantiated object for each instantiated object of the wrapper component, specifically includes: When a change is detected in the source data of the application, the cache corresponding to the wrapper component is notified to perform object traversal processing. For each instantiated object encountered during the traversal, data related to a specified field corresponding to the instantiated object is extracted from the changed data to obtain the target data corresponding to the instantiated object.
6. The method according to any one of claims 1 to 5, characterized in that, The steps of performing a refresh operation on the target refresh object specifically include: Update the field value of the specified field of the target refresh object based on the target data corresponding to the target refresh object; The target refresh object is rendered based on the updated field values to achieve a partial refresh of the wrapper component.
7. An application intelligent refresh device, characterized in that, The device includes: A listening module is used to listen for changes in the source data of the application through a wrapper component of the application; the wrapper component is a component generated by binding a specified component of the application to a plurality of specified fields in the source data; each instantiated object of the wrapper component corresponds to at least a portion of the specified fields; The extraction module is used to extract data related to a specified field corresponding to the instantiated object from the changed data for each instantiated object of the wrapping component when the source data of the application is detected to have changed, so as to obtain the target data corresponding to the instantiated object. The refresh module is used to compare the field value corresponding to a specified field of each instantiated object with the target data. When the target data is different from the field value, the target data is compared with a preset threshold. When the comparison result indicates that the target data will cause a change in the display of the corresponding instantiated object, the instantiated object is determined as the target refresh object, and a refresh operation is performed on the target refresh object.
8. The apparatus according to claim 7, characterized in that, The device further includes a parsing module, which is used for: An abstract syntax tree is obtained by converting the source code of the application page of the application; the application page is obtained by editing multiple wrapper components of the application. The abstract syntax tree is parsed to obtain multiple wrapper components loaded by the application.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.