Life cycle event monitoring method and device, medium and program product

By using decorators to establish data synchronization relationships in pages and subviews, the problem that the prior art cannot listen to page lifecycle events in subviews is solved, and the effect of efficiently and reliably listening to page lifecycle events in subviews is achieved.

CN120029847APending Publication Date: 2025-05-23KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411886240.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

The prior art can only listen for page lifecycle events at the page level, and cannot listen for page lifecycle events in subviews.

Method used

The target state variable of the target page decorating the first decorator and the target state variable of the second decorating the target subview are established to ensure that the target data of the first decorating variable is synchronized through the second decorating variable during the subview display, thereby monitoring the life cycle event of the target page.

Benefits of technology

It realizes that the lifecycle events of the page can also be listened to in the subview, solving the problem that traditional methods cannot listen to the lifecycle events of the page in the subview, and improving the convenience and reliability of monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029847A_ABST
    Figure CN120029847A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a life cycle event monitoring method and device, a medium and a program product, and the method comprises the steps: decorating a target state variable corresponding to a target page through a first decorator, and obtaining a first decoration variable; decorating a target state variable corresponding to the target sub-view through a second decorator to obtain a second decoration variable; wherein the first decorator and the second decorator have an association relationship, and a first decoration variable obtained by decoration of the first decorator and a second decoration variable obtained by decoration of the second decorator have a data synchronization relationship; and during the display period of the target sub-view, synchronizing target data of the first decoration variable through the second decoration variable, and monitoring a life cycle event of the target page based on the target data. According to the embodiment of the invention, the purpose of monitoring the life cycle event of the page in the sub-view can be conveniently and reliably achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, medium and program product for monitoring lifecycle events. Background Art

[0002] With the continuous development of smart terminals and network technology, more and more applications can be supported. For applications, it is necessary to monitor the life cycle events of pages. However, the inventors have found through research that currently only the page level can monitor the life cycle events of pages. Once a subview is entered, the life cycle events of the page cannot be monitored in the subview. Summary of the invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, device, medium and program product for monitoring lifecycle events.

[0004] An embodiment of the present disclosure provides a method for monitoring lifecycle events, the method comprising: decorating a target state variable corresponding to a target page with a first decorator to obtain a first decoration variable; decorating a target state variable corresponding to a target subview with a second decorator to obtain a second decoration variable; wherein the first decorator and the second decorator are associated with each other, and a data synchronization relationship exists between the first decoration variable obtained by the decoration of the first decorator and the second decoration variable obtained by the decoration of the second decorator; during the display of the target subview, the target data of the first decoration variable is synchronized with the second decoration variable, and the lifecycle events of the target page are monitored based on the target data.

[0005] Optionally, the target state variable includes a target object and a target Boolean value; wherein the target object is used to transmit data related to the lifecycle event, and the target Boolean value is used to indicate whether the data transmitted by the target object has changed.

[0006] Optionally, the target object is also used to transfer custom data.

[0007] Optionally, synchronizing the target data of the first decoration variable through the second decoration variable includes: synchronizing the target Boolean value in the first decoration variable through the target Boolean value in the second decoration variable, and judging whether the target data passed by the target object in the first decoration variable has changed based on the synchronized target Boolean value; in the event that the target data has changed, synchronizing the target data of the first decoration variable through the target object in the second decoration variable.

[0008] Optionally, the number of the target sub-views is one or more; when the number of the target sub-views is multiple, synchronizing the target data of the first decoration variable through the second decoration variable during the display of the target sub-view, including: in response to the target tag being triggered, determining the target sub-view corresponding to the target tag from the multiple target sub-views, and synchronizing the target data of the first decoration variable through the second decoration variable of the target sub-view corresponding to the target tag during the display of the target sub-view corresponding to the target tag.

[0009] Optionally, the target page is separated from the target sub-view by one or more levels.

[0010] Optionally, the method further includes: executing processing logic corresponding to the monitoring result of the life cycle event.

[0011] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement a method for monitoring life cycle events as provided in an embodiment of the present disclosure.

[0012] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the method for monitoring life cycle events as provided in the embodiment of the present disclosure.

[0013] The embodiments of the present disclosure also provide a computer program product, including a computer program, which, when executed by a processor, implements the method for monitoring life cycle events provided in the embodiments of the present disclosure.

[0014] The above technical solution provided by the embodiment of the present disclosure is to decorate the target state variable corresponding to the target page with the first decorator to obtain the first decoration variable; to decorate the target state variable corresponding to the target subview with the second decorator to obtain the second decoration variable; because the first decorator and the second decorator have an association relationship, the first decoration variable obtained by the decoration of the first decorator and the second decoration variable obtained by the decoration of the second decorator have a data synchronization relationship, so during the display of the target subview, the target data of the first decoration variable can be synchronized through the second decoration variable, and the life cycle events of the target page can be monitored based on the target data. In the above manner, the purpose of monitoring the life cycle events of the page in the subview can be achieved conveniently and reliably.

[0015] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1 A schematic diagram of an interface provided by an embodiment of the present disclosure;

[0019] Figure 2 A flowchart of a method for monitoring life cycle events provided by an embodiment of the present disclosure;

[0020] Figure 3 A schematic diagram of a monitoring principle of a life cycle event provided by an embodiment of the present disclosure;

[0021] Figure 4 A schematic diagram of the structure of a monitoring device for life cycle events provided by an embodiment of the present disclosure;

[0022] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0024] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0025] The inventor has found that in the related art, only the page level can monitor the page life cycle events, and it is impossible to monitor the page life cycle events through the sub-view. However, some specific needs currently hope to monitor the page life cycle events in time after entering the sub-view, so as to carry out subsequent specific processing in a targeted manner based on the monitoring results. For ease of understanding, refer to Figure 1A schematic diagram of an interface is shown, and the interface as a whole can be regarded as a page. Three tabs are illustrated in the page, namely "Home", "Message" and "My". Among them, the sub-view presented to the user after the tab is triggered, which can also be understood as that the page contains the "Home" sub-view, "Message" sub-view and "My" sub-view. If the "Home" tab is triggered, it will be presented as the "Home" sub-view on the interface, but at this time the life cycle events of the aforementioned page can no longer be monitored. In order to improve this problem, the embodiments of the present disclosure provide a method, device, medium and program product for monitoring life cycle events, which are explained in detail below.

[0026] Figure 2 The present invention provides a flow chart of a method for monitoring lifecycle events according to an embodiment of the present invention. The method can be performed by a device for monitoring lifecycle events, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method mainly includes the following steps S202 to S206:

[0027] Step S202: decorate the target state variable corresponding to the target page by using a first decorator to obtain a first decoration variable.

[0028] Decorators can be used to decorate specified variables. In some specific implementation examples, the first decorator can be a Provide decorator. Variables decorated with the Provide decorator can be automatically available to all its descendant components without having to pass the variables between components multiple times. The disclosed embodiment does not limit the target page. Any page that needs to monitor life cycle events, such as the home page, can be used as the target page. In addition, the disclosed embodiment does not limit the target state variable of the target page, and can be flexibly set according to demand. Types such as objects, classes, strings, numbers, Boolean values, enumerations, etc. are all acceptable. Any state variable that can pass data related to the life cycle events of the page is acceptable.

[0029] Step S204, decorating the target state variable corresponding to the target subview with the second decorator to obtain a second decoration variable; wherein the first decorator and the second decorator are associated with each other, and a data synchronization relationship exists between the first decoration variable decorated by the first decorator and the second decoration variable decorated by the second decorator.

[0030] Exemplarily, the first decorator and the second decorator can be implemented with the help of decorators provided by the Hongmeng system. In some specific implementation examples, the first decorator is the Provide decorator, and the second decorator is the Consume decorator. By decorating the same variable, the two can realize bidirectional data synchronization between the state variables of the page and the subview, and can realize data synchronization between multiple levels, that is, the target page and the target subview can be separated by one or more levels. As long as the corresponding target state variables are decorated by the above decorators, independent data transmission can be realized conveniently and quickly without notification or transmission layer by layer.

[0031] In addition, the embodiments of the present disclosure do not limit the content of the target sub-view and the number of target sub-views. Any sub-view that needs to monitor the life cycle events of the target page can be used as a target sub-view, and the number of target sub-views can be one or more.

[0032] Step S206: during the display of the target subview, synchronize the target data of the first decoration variable through the second decoration variable, and monitor the life cycle events of the target page based on the target data.

[0033] The first decoration variable is the target state variable after being decorated by the first decorator, and the second decoration variable is the target state variable after being decorated by the second decorator. The two have a binding relationship, and the target data of the first decoration variable can be directly synchronized through the second decoration variable, and the data monitoring of the target page can be realized in the subview, and then the life cycle events of the target page can be monitored based on the target data. The disclosed embodiment does not limit the target data, and it can be flexibly set, such as the target data is data related to the life cycle event, such as the name of the life cycle method, the current user operation information, etc., and it can also be the required custom data, which will not be listed one by one here. In addition, in actual applications, the life cycle events that need to be monitored can be flexibly set according to needs, such as onPageShow events, onPageHide events, etc., which are not limited here. Through the above method, even during the display of the target subview, the target data of the page can be easily and quickly obtained, thereby achieving the purpose of monitoring the life cycle events of the target page. In addition, the subview monitors the life cycle events of the target page, which can also be expressed as the subview receiving the life cycle events of the target page, or the subview monitoring the life cycle methods of the target page.

[0034] In some specific implementation examples, in order to monitor life cycle events more efficiently and reliably, the target state variable may include a target object and a target Boolean value; wherein the target object is used to transmit data related to the life cycle event, such as the life cycle method name, current operation, etc. Any data related to the life cycle event can be used as data transmitted by the target object, which can be flexibly set. Exemplarily, the target object may be a lifeCycle object. Further, the target object is also used to transmit custom data, which can be flexibly set, such as event name, tag information, jump URL (Uniform Resource Locator) information, etc., which are not limited here. The target Boolean value is used to indicate whether the data transmitted by the target object has changed, such as using one value to indicate a change and another value to indicate no change. In the above manner, it is possible to efficiently determine whether the data has changed with the help of Boolean values. Exemplarily, the target Boolean value may be a lifeCycleChange Boolean value. Based on the above, the above step of synchronizing the target data of the first decorative variable through the second decorative variable can be performed with reference to the following steps (1) and (2):

[0035] Step (1) synchronizes the target Boolean value in the first decoration variable with the target Boolean value in the second decoration variable, and determines whether the target data transmitted by the target object in the first decoration variable has changed based on the synchronized target Boolean value. As mentioned above, the target Boolean value is represented by one value to indicate a change and another value to indicate no change. Based on the specific value of the target Boolean value, it is possible to clearly know whether the target data transmitted by the target object in the first decoration variable has changed.

[0036] Step (2), when the target data changes, the target data of the first decoration variable is synchronized through the target object in the second decoration variable.

[0037] Through the above method, it is possible to first efficiently determine whether the data has changed through the target Boolean value, and then synchronize the data through the target object if it has changed. This data synchronization method can not only ensure the reliability of data synchronization, thereby ensuring the reliability of the results of data monitoring life cycle events based on synchronization, but also effectively save processing resources.

[0038] In the case where there are multiple target subviews, the aforementioned step of synchronizing the target data of the first decoration variable through the second decoration variable during the display of the target subview can be performed with reference to the following steps: in response to the target tag being triggered, determining the target subview corresponding to the target tag from multiple target subviews, and synchronizing the target data of the first decoration variable through the second decoration variable of the target subview corresponding to the target tag during the display of the target subview corresponding to the target tag. Figure 1 For example, the sub-views corresponding to the three labels "Home", "Message" and "My" can all be used as target sub-views. Assuming that the "Home" label is triggered, the "Home" sub-view is displayed on the interface. During the display of the "Home" sub-view, the life cycle events of the target page can be monitored through the decorated state variables corresponding to the "Home" sub-view. Among them, the target page is the page bound to the "Home" sub-view in the above way.

[0039] For easier understanding, see Figure 3 The diagram of the monitoring principle of a life cycle event shown in FIG. 1 shows that a target page can be associated with multiple sub-views, that is, multiple sub-views can monitor the life cycle events of the target page. Figure 3 Indicates sub-view Figure 1 To subview M. Among them, multiple life cycle events to be monitored are presented on the target page, taking life cycle event 1 (such as onPageShow event), life cycle event 2 (such as onPageHide event), and life cycle event n as examples to illustrate, and illustrating that the first decorator (such as Provide decorator) can be used to decorate the target object (such as lifeCycle object) and the target Boolean value (such as lifeCycleChange Boolean value). Similarly, the subview Figure 1 It is illustrated that the second decorator (such as the Consume decorator) can be used to decorate the target object and the target Boolean value, and it is also illustrated that the subview can detect the life cycle event 1, life cycle event 2, life cycle event n, etc. corresponding to the target page.

[0040] Furthermore, the method provided by the embodiment of the present disclosure also includes: executing the processing logic corresponding to the monitoring result of the life cycle event. In practical applications, the mapping relationship between different monitoring results and different processing logics can be flexibly set, and the embodiment of the present disclosure does not limit this. After obtaining the monitoring result of the life cycle event, the corresponding processing logic, such as pop-up window processing, can be executed.

[0041] In summary, the method for monitoring lifecycle events provided by the embodiment of the present disclosure uses a first decorator (such as a Provide decorator) to decorate the target state variable corresponding to the target page, and uses a second decorator (such as a Consume decorator) to decorate the target state variable corresponding to the target subview. Specifically, the target state variable may include a target object for transmitting data related to the lifecycle event, and a target Boolean value for indicating whether the data transmitted by the target object has changed, so that data synchronization can be achieved conveniently and quickly through the decorated target state variable. The subview can monitor the lifecycle events of the target page based on the synchronized data. In addition, the first decorator and the second decorator only need to be declared, and multi-level data transmission can be achieved without the need for transmission between parent and child. In other words, independent data transmission can be achieved with the help of decorators, which can enable the subview to monitor the lifecycle events of the page more efficiently and timely, and achieve the effect of traceless monitoring. The above method provided by the embodiment of the present disclosure conveniently and reliably achieves the purpose of monitoring the lifecycle events of the page in the subview.

[0042] Corresponding to the above-mentioned monitoring method for life cycle events, the embodiment of the present disclosure further provides a monitoring device for life cycle events. Figure 4 This is a schematic diagram of the structure of a monitoring device for life cycle events provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated in an electronic device, such as Figure 4 As shown, the monitoring device for life cycle events includes:

[0043] A first decoration module 402, decorating a target state variable corresponding to a target page by a first decorator to obtain a first decoration variable;

[0044] The second decoration module 404 decorates the target state variable corresponding to the target subview by a second decorator to obtain a second decoration variable; wherein the first decorator and the second decorator are associated with each other, and a data synchronization relationship exists between the first decoration variable decorated by the first decorator and the second decoration variable decorated by the second decorator;

[0045] The event monitoring module 406 synchronizes the target data of the first decoration variable through the second decoration variable during the display of the target subview, and monitors the life cycle events of the target page based on the target data.

[0046] Through the above method, the purpose of monitoring the life cycle events of the page in the subview can be achieved conveniently and reliably.

[0047] In some embodiments, the target state variable includes a target object and a target Boolean value; wherein the target object is used to transmit data related to the lifecycle event, and the target Boolean value is used to indicate whether the data transmitted by the target object has changed.

[0048] In some implementations, the target object is also used to pass custom data.

[0049] In some embodiments, the event monitoring module 406 is specifically used to: synchronize the target Boolean value in the first decoration variable through the target Boolean value in the second decoration variable, and determine whether the target data transmitted by the target object in the first decoration variable has changed based on the synchronized target Boolean value; when the target data has changed, synchronize the target data of the first decoration variable through the target object in the second decoration variable.

[0050] In some embodiments, the number of the target sub-views is one or more; when the number of the target sub-views is multiple, the event listening module 406 is specifically used to: in response to the target tag being triggered, determine the target sub-view corresponding to the target tag from the multiple target sub-views, and synchronize the target data of the first decoration variable through the second decoration variable of the target sub-view corresponding to the target tag during the display of the target sub-view corresponding to the target tag.

[0051] In some implementations, the target page is separated from the target sub-view by one or more levels.

[0052] In some implementations, the device further includes: an execution module, configured to execute processing logic corresponding to a monitoring result of the lifecycle event.

[0053] The device for monitoring lifecycle events provided in the embodiments of the present disclosure can execute the method for monitoring lifecycle events provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0054] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device embodiment can refer to the corresponding process in the method embodiment, and will not be repeated here.

[0055] An embodiment of the present disclosure provides an electronic device, which includes: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any method in the present disclosure.

[0056] Reference below Figure 5, which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0057] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0058] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0059] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program carried on a non-transitory computer-readable medium, the computer program comprising a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0060] In addition to the above-mentioned methods and devices, the embodiments of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, cause the processor to perform the method provided by the embodiments of the present disclosure. The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present disclosure, the programming languages ​​including object-oriented programming languages ​​such as Java, C++, etc., and also conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on a user computing device, partially on a user device, as an independent software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0061] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the method for monitoring life cycle events provided by the embodiment of the present disclosure.

[0062] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0063] The embodiments of the present disclosure also provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the method for monitoring life cycle events in the embodiments of the present disclosure.

[0064] It is understandable that before using the technical solutions disclosed in the various embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0065] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0066] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0067] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0068] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0069] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be 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 the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for monitoring life cycle events, characterized in that: include: Decorate the target state variable corresponding to the target page by using the first decorator to obtain a first decorated variable; Decorating the target state variable corresponding to the target subview with the second decorator to obtain a second decoration variable; wherein the first decorator and the second decorator are associated with each other, and a data synchronization relationship exists between the first decoration variable obtained by decorating with the first decorator and the second decoration variable obtained by decorating with the second decorator; During the display of the target subview, the target data of the first decoration variable is synchronized through the second decoration variable, and the life cycle events of the target page are monitored based on the target data.

2. The method according to claim 1, characterized in that The target state variable includes a target object and a target Boolean value; wherein the target object is used to transmit data related to life cycle events, and the target Boolean value is used to indicate whether the data transmitted by the target object has changed.

3. The method according to claim 2, characterized in that The target object is also used to pass custom data.

4. The method according to claim 2, characterized in that: The step of synchronizing the target data of the first decoration variable through the second decoration variable includes: Synchronize the target Boolean value in the first decoration variable through the target Boolean value in the second decoration variable, and determine whether the target data transmitted by the target object in the first decoration variable has changed based on the synchronized target Boolean value; When the target data changes, the target data of the first decoration variable is synchronized through the target object in the second decoration variable.

5. The method according to claim 1, characterized in that: The number of the target subviews is one or more; In the case that there are multiple target subviews, synchronizing target data of the first decoration variable through the second decoration variable during display of the target subview includes: In response to a target tag being triggered, a target sub-view corresponding to the target tag is determined from multiple target sub-views, and during the display of the target sub-view corresponding to the target tag, the target data of the first decoration variable is synchronized through the second decoration variable of the target sub-view corresponding to the target tag.

6. The method according to claim 1, characterized in that The target page is separated from the target sub-view by one or more levels.

7. The method according to claim 1, characterized in that The method further comprises: Execute the processing logic corresponding to the monitoring result of the life cycle event.

8. An electronic device, characterized in that: The electronic device comprises: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method for monitoring life cycle events described in any one of claims 1-7.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the method for monitoring life cycle events as described in any one of claims 1 to 7.

10. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the method for monitoring life cycle events according to any one of claims 1 to 7.