Front-end state management method, device, equipment, medium and product
By dynamically adjusting the state management strategy for each front-end module, the problem of insufficient flexibility and scalability of state management in large front-end applications is solved, and the flexibility and scalability are improved.
Patent Information
- Application Number
- CN202411153265.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-03
AI Technical Summary
In the existing technology, in large-scale front-end applications, a unified state management strategy leads to poor flexibility and scalability of state management, which cannot meet the diverse state management needs of different modules.
By obtaining multiple front-end modules and establishing their corresponding state container classes, obtaining the initial state management policy, and dynamically adjusting the state management policy according to the running parameters collected in real time, assigning different state management policies to each module to improve flexibility and expansion sex.
It realizes the flexibility and scalability of front-end state management, and can dynamically adjust the state management strategy according to the operating parameters of the module to meet the diversified needs of different modules.
Smart Images

Figure CN119065843A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a front-end state management method, device, equipment, medium and product. Background Art
[0002] In a large front-end application, there may be multiple independent modules, each with different state management requirements. For example, module A requires frequently updated real-time data, module B needs to process a large amount of form data and validation, and module C needs to perform complex calculations and caching.
[0003] At present, for front-end modules with different state management requirements, a unified state management strategy is usually used for state management, resulting in poor flexibility and scalability of state management. Summary of the invention
[0004] The present invention provides a front-end status management method, device, equipment, medium and product, which can improve the flexibility and scalability of front-end status management.
[0005] According to one aspect of the present invention, there is provided a front-end state management method, comprising:
[0006] Acquire multiple front-end modules and establish a state container class corresponding to each of the front-end modules;
[0007] Obtaining the initial state management strategy corresponding to each of the front-end modules through each of the state container classes;
[0008] According to each of the initial state management strategies, the operating parameters of each of the front-end modules are collected in real time. If it is determined based on the current operating parameters that the state management strategy of the current front-end module needs to be updated, the state container class corresponding to the current front-end module is used to determine the updated state management strategy corresponding to the current front-end module based on the current operating parameters.
[0009] According to another aspect of the present invention, there is provided a front-end state management device, comprising:
[0010] A front-end module acquisition module, used to acquire multiple front-end modules and establish a state container class corresponding to each of the front-end modules;
[0011] An initial state management strategy acquisition module, used to acquire the initial state management strategy corresponding to each of the front-end modules through each of the state container classes;
[0012] The state management strategy update module is used to collect the operating parameters of each of the front-end modules in real time according to each of the initial state management strategies. If it is determined based on the current operating parameters that the state management strategy of the current front-end module needs to be updated, the state container class corresponding to the current front-end module is used to determine the updated state management strategy corresponding to the current front-end module according to the current operating parameters.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the front-end state management method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program is used to enable a processor to implement the front-end state management method described in any embodiment of the present invention when executed.
[0018] According to another aspect of the present invention, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the front-end state management method according to any embodiment of the present invention is implemented.
[0019] The technical solution of the embodiment of the present invention is to obtain multiple front-end modules and establish a state container class corresponding to each front-end module; obtain the initial state management strategy corresponding to each front-end module through each state container class; collect the operating parameters of each front-end module in real time according to each initial state management strategy, and if it is determined according to the current operating parameters that the state management strategy of the current front-end module needs to be updated, then determine the updated state management strategy corresponding to the current front-end module according to the current operating parameters through the state container class corresponding to the current front-end module; by assigning different state management strategies to different front-end modules and dynamically adjusting the assigned state management strategies according to the operating parameters of the front-end modules, the flexibility and scalability of the front-end state management can be improved.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a flow chart of a front-end state management method provided according to Embodiment 1 of the present invention;
[0023] Figure 2 is a schematic diagram of the structure of a front-end state management device provided according to Embodiment 2 of the present invention;
[0024] Figure 3 It is a structural schematic diagram of an electronic device for implementing the front-end state management method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", "target", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] Embodiment 1
[0028] Figure 1A flowchart of a front-end state management method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of performing state management on a front-end module. The method can be executed by a front-end state management device. The front-end state management device can be implemented in the form of hardware and / or software. Typically, the front-end state management device can be configured in an electronic device, such as a computer device or a server. Figure 1 As shown, the method includes:
[0029] S110, obtaining multiple front-end modules, and establishing a state container class corresponding to each of the front-end modules.
[0030] The front-end module may be a program code for implementing the front-end function of the application, and the type of the front-end module may not be specifically limited in this embodiment. For example, the front-end module may include a user management module, a shopping cart module, an order processing module, and the like.
[0031] In this embodiment, the code of the current application can be parsed to obtain the front-end modules it includes, and a corresponding state container class can be automatically created for each front-end module. Among them, the state container class can be a written container instance used to configure and adjust the state management strategy of the front-end module. For example, the state container class can include (1) a construction method for receiving a strategy object and storing it as the current state management strategy; (2) a setStrategy method for allowing dynamic replacement of the current state management strategy; (3) a getState method for calling the getState method of the current state management strategy to obtain the state of the front-end module; (4) a setState method for calling the setState method of the current state management strategy to set the state; (5) a subscribe method for calling the subscribe method of the current state management strategy to add a listener.
[0032] S120. Obtaining the initial state management strategy corresponding to each of the front-end modules through each of the state container classes.
[0033] Specifically, the construction method in each state container class can be used to configure the initial state management strategy, i.e., the initial state management strategy, for the corresponding front-end module according to the user's policy configuration operation. Alternatively, the state management requirements of each front-end module can be matched with the applicable scenarios of each state management strategy to determine the state management strategy that matches each front-end module; then, the construction method in each state container class can be used to set the corresponding initial state management strategy for each front-end module according to the matching relationship between the front-end module and the state management strategy.
[0034] Among them, the state management strategy can be a strategy method that is pre-defined by the user in a unified strategy format and is applicable to different scenarios. Typically, the state management strategy can include a simple state management strategy, a complex state management strategy and / or an advanced state management strategy. Different state management strategies are used to support different state management requirements of front-end modules. For example, the simple state management strategy supports the use of ordinary object storage module states, the complex state management strategy supports the use of Map object storage module states, and supports efficient add, delete, modify, and query operations. The advanced state management strategy supports persistence and transaction management.
[0035] In a specific example, the current application is an e-commerce system, and the front-end module includes a user management module, a shopping cart module, and an order processing module, wherein the user management module is used to process user information and authentication, and requires frequent updates of user status, the shopping cart module is used to manage the user's shopping cart, and involves frequent addition, deletion, modification, and query operations, and the order processing module is used to process user orders, which requires complex state management and persistence. At this point, the state management requirements of each front-end module can be matched one by one with the applicable scenarios of each preset state management strategy (for example, keyword matching, etc.) to obtain the final matching detection result, for example, the user management module matches the simple state management strategy, the shopping cart module matches the complex state management strategy, and the order processing module matches the advanced state management strategy.
[0036] Optionally, before obtaining the initial state management strategy corresponding to each of the front-end modules through each of the state container classes, the following may also be included:
[0037] According to the predefined policy interface, a unified format of state management policies is obtained, and according to the unified format of state management policies, multiple state management policies are generated.
[0038] In this embodiment, a standard state management policy interface can be first defined, which includes basic state operation methods and is used to set a unified format for the state management policy; then, different specific method contents can be configured for each state operation method according to the unified format of the state management policy, thereby creating multiple different state management policies.
[0039] The unified format of the state management strategy may include a method for obtaining state, a method for setting state, a method for subscribing to state changes, and / or a method for notifying a monitor. In this embodiment, by abstracting the state management requirements of the front-end module, methods that need to be implemented by all state management strategies can be obtained, namely, a method for obtaining state (getState), a method for setting state (setState), a method for subscribing to state changes (subscribe), and a method for notifying a monitor (notify).
[0040] In a specific example, the content of a simple state management strategy may include using a common object to store the state, returning the current state object through the getState method, receiving a new state object through the setState method and merging it with the current state, and then notifying all listeners, using the subscribe method to add a listener for state changes, and traversing all listeners and calling them through the notify method to pass the current state to them.
[0041] As another example, the content of a complex state management strategy may include using a Map object to store the state, receiving a key through the getState method, returning the state value corresponding to the key, receiving a key-value pair through the setState method, storing it in the Map, and notifying all listeners, using the subscribe method to add a listener for state changes, and using the notify method to traverse all listeners and call them, and pass the current Map state to them.
[0042] In this embodiment, the coupling degree of the state management logic is reduced and the maintainability of the code is enhanced through the standardized strategy interface design.
[0043] S130. According to each of the initial state management strategies, the operating parameters of each of the front-end modules are collected in real time. If it is determined based on the current operating parameters that the state management strategy of the current front-end module needs to be updated, the state container class corresponding to the current front-end module is used to determine the updated state management strategy corresponding to the current front-end module based on the current operating parameters.
[0044] Specifically, after determining the initial state management strategy corresponding to each front-end module, state management can be performed for the corresponding front-end module based on the initial state management strategy, so as to collect the operating parameters of each front-end module in real time, such as traffic, memory usage, etc. Afterwards, if it is detected that the operating parameters of a certain front-end module have undergone a sudden change, for example, the difference between the network traffic at the current moment and the network traffic at the previous moment is greater than the set traffic threshold, etc., it can be determined that the state management strategy of the front-end module needs to be updated; or, if it is detected that the operating parameters of a certain front-end module no longer match the applicable scenario of the current initial state management strategy, it can be determined that the state management strategy of the front-end module needs to be updated.
[0045] Furthermore, when updating the state management strategy of a front-end module, the current operating parameters can be matched with the applicable scenarios of each preset state management strategy through the setStrategy method in the state container class corresponding to the front-end module, so as to find the preset state management strategy that matches the current operating parameters as the updated state management strategy corresponding to the front-end module. Finally, the initial state management strategy corresponding to the front-end module can be replaced with the updated state management strategy through the setStrategy method.
[0046] Optionally, after obtaining the initial state management strategy corresponding to each of the front-end modules through each of the state container classes, it may also include: collecting the current state management requirements of each front-end module in real time according to each initial state management strategy; if it is detected that the current state management requirement of a front-end module does not match the applicable scenario of its corresponding initial state management strategy, it is determined that the state management policy of the detected front-end module needs to be updated.
[0047] In a specific example, the initial state management strategy corresponding to the shopping cart module is a complex state management strategy. During operation, the shopping cart module has new persistence requirements, and the current complex state management strategy cannot meet the persistence requirements. At this time, the complex state management strategy can be replaced with an advanced state management strategy to adapt to the ever-changing module requirements.
[0048] Optionally, determining that the state management strategy of the current front-end module needs to be updated according to the current operating parameters may include:
[0049] It is determined whether the current operating parameters of the current front-end module match the applicable scenario of the initial state management strategy corresponding to the current front-end module. If it is determined that they do not match, it is determined that the state management strategy of the current front-end module needs to be updated.
[0050] In this embodiment, for each state management strategy, a corresponding applicable scenario can be preset, and typically, the applicable scenario can be a parameter range. Therefore, when determining whether the state management strategy needs to be updated, it can be determined whether the current operating parameters of each front-end module are within the parameter range of the applicable scenario of its corresponding initial state management strategy; if it is determined to be within the parameter range, it means that it matches and does not need to be updated; if it exceeds the parameter range, it means that it does not match and needs to be updated.
[0051] It should be noted that this embodiment can collect corresponding operating parameters in real time based on the current state management strategy of each front-end module, and can dynamically adjust the state management strategy according to the real-time operating parameters through the state container class corresponding to each front-end module.
[0052] Optionally, the technical solution of the embodiment of the present invention may further include adopting a current state management strategy corresponding to the current front-end module to perform state management on the current front-end module.
[0053] In this embodiment, the state management strategy allocated to each front-end module can be used to manage the state of each front-end module, for example, the collection and storage of operating parameters, the setting and adjustment of module parameters, etc.
[0054] In this embodiment, by configuring the most appropriate state management strategy for the front-end module according to its needs, the flexibility of the front-end state management can be improved; secondly, it supports the combination of multiple state management strategies to implement complex state management logic and meet higher-level application requirements, thereby improving the scalability of the front-end state management.
[0055] The technical solution of the embodiment of the present invention is to obtain multiple front-end modules and establish a state container class corresponding to each front-end module; obtain the initial state management strategy corresponding to each front-end module through each state container class; collect the operating parameters of each front-end module in real time according to each initial state management strategy, and if it is determined according to the current operating parameters that the state management strategy of the current front-end module needs to be updated, then determine the updated state management strategy corresponding to the current front-end module according to the current operating parameters through the state container class corresponding to the current front-end module; by assigning different state management strategies to different front-end modules and dynamically adjusting the assigned state management strategies according to the operating parameters of the front-end modules, the flexibility and scalability of the front-end state management can be improved.
[0056] Embodiment 2
[0057] Figure 2 This is a schematic diagram of the structure of a front-end state management device provided in Embodiment 2 of the present invention. Figure 2 As shown, the device includes: a front-end module acquisition module 210, an initial state management strategy acquisition module 220 and a state management strategy update module 230; wherein,
[0058] The front-end module acquisition module 210 is used to acquire multiple front-end modules and establish a state container class corresponding to each of the front-end modules;
[0059] An initial state management strategy acquisition module 220, used to acquire the initial state management strategy corresponding to each of the front-end modules through each of the state container classes;
[0060] The state management policy update module 230 is used to collect the operating parameters of each of the front-end modules in real time according to each of the initial state management policies. If it is determined based on the current operating parameters that the state management policy of the current front-end module needs to be updated, the state container class corresponding to the current front-end module is used to determine the updated state management policy corresponding to the current front-end module according to the current operating parameters.
[0061] The technical solution of the embodiment of the present invention is to obtain multiple front-end modules and establish a state container class corresponding to each front-end module; obtain the initial state management strategy corresponding to each front-end module through each state container class; collect the operating parameters of each front-end module in real time according to each initial state management strategy, and if it is determined according to the current operating parameters that the state management strategy of the current front-end module needs to be updated, then determine the updated state management strategy corresponding to the current front-end module according to the current operating parameters through the state container class corresponding to the current front-end module; by assigning different state management strategies to different front-end modules and dynamically adjusting the assigned state management strategies according to the operating parameters of the front-end modules, the flexibility and scalability of the front-end state management can be improved.
[0062] Optionally, the front-end state management device further includes:
[0063] The state management policy generation module is used to obtain a unified format of state management policies according to a predefined policy interface, and generate multiple state management policies according to the unified format of state management policies.
[0064] Optionally, the unified format of the state management policy includes a method for obtaining state, a method for setting state, a method for subscribing to state changes, and / or a method for notifying monitors.
[0065] Optionally, the state management policy update module 230 is specifically used to determine whether the current operating parameters of the current front-end module match the applicable scenario of the initial state management policy corresponding to the current front-end module. If it is determined that there is no match, it is determined that the state management policy of the current front-end module needs to be updated.
[0066] Optionally, the front-end state management device further includes:
[0067] The state management module is used to adopt the current state management strategy corresponding to the current front-end module to perform state management on the current front-end module.
[0068] Optionally, the state management strategy includes a simple state management strategy, a complex state management strategy and / or an advanced state management strategy.
[0069] The front-end state management device provided in the embodiment of the present invention can execute the front-end state management method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0070] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0071] Embodiment 3
[0072] Figure 3 A schematic diagram of the structure of an electronic device 30 that can be used to implement an embodiment of the present invention is shown. The electronic device 30 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 30 can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0073] like Figure 3 As shown, the electronic device 30 includes at least one processor 31, and a memory connected to the at least one processor 31, such as a read-only memory (ROM) 32, a random access memory (RAM) 33, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 31 can perform various appropriate actions and processes according to the computer program stored in the read-only memory 32 or the computer program loaded from the storage unit 38 to the random access memory 33. In the RAM 33, various programs and data required for the operation of the electronic device 30 can also be stored. The processor 31, the ROM 32 and the RAM 33 are connected to each other through a bus 34. The input / output (I / O) interface 35 is also connected to the bus 34.
[0074] A number of components in the electronic device 30 are connected to the I / O interface 35, including: an input unit 36, such as a keyboard, a mouse, etc.; an output unit 37, such as various types of displays, speakers, etc.; a storage unit 38, such as a disk, an optical disk, etc.; and a communication unit 39, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 39 allows the electronic device 30 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0075] The processor 31 may be a variety of general and / or dedicated processing components with processing and computing capabilities. Some examples of the processor 31 include, but are not limited to, a central processing unit, a graphics processing unit, various dedicated artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any appropriate processors, controllers, microcontrollers, etc. The processor 31 executes the various methods and processes described above, such as the front-end state management method.
[0076] In some embodiments, the front-end state management method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 38. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 30 via the ROM 32 and / or the communication unit 39. When the computer program is loaded into the RAM 33 and executed by the processor 31, one or more steps of the front-end state management method described above may be performed. Alternatively, in other embodiments, the processor 31 may be configured to perform the front-end state management method in any other appropriate manner (e.g., by means of firmware).
[0077] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays, application specific integrated circuits, application specific standard products, systems on a chip, load programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0078] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0079] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0080] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device 30 having: a display device (e.g., a cathode ray tube or a liquid crystal display) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the electronic device 30. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0081] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area networks, wide area networks, blockchain networks, and the Internet.
[0082] A computing system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other. The server may be a cloud server.
[0083] This embodiment may also include a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the front-end state management method provided by any embodiment of the present invention.
[0084] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0085] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A front-end state management method, characterized in that: include: Acquire multiple front-end modules and establish a state container class corresponding to each of the front-end modules; Obtaining the initial state management strategy corresponding to each of the front-end modules through each of the state container classes; According to each of the initial state management strategies, the operating parameters of each of the front-end modules are collected in real time. If it is determined based on the current operating parameters that the state management strategy of the current front-end module needs to be updated, the state container class corresponding to the current front-end module is used to determine the updated state management strategy corresponding to the current front-end module based on the current operating parameters.
2. The method according to claim 1, characterized in that Before obtaining the initial state management strategy corresponding to each of the front-end modules through each of the state container classes, the method further includes: According to the predefined policy interface, a unified format of state management policies is obtained, and according to the unified format of state management policies, multiple state management policies are generated.
3. The method according to claim 2, characterized in that The unified format of the state management strategy includes a get state method, a set state method, a subscribe state change method and / or a notify monitor method.
4. The method according to claim 1, characterized in that: Determine the need to update the state management strategy of the current front-end module based on the current operating parameters, including: It is determined whether the current operating parameters of the current front-end module match the applicable scenario of the initial state management strategy corresponding to the current front-end module. If it is determined that they do not match, it is determined that the state management strategy of the current front-end module needs to be updated.
5. The method according to claim 1, characterized in that Also includes: The current state management strategy corresponding to the current front-end module is adopted to manage the state of the current front-end module.
6. The method according to any one of claims 1 to 5, characterized in that The state management strategy includes a simple state management strategy, a complex state management strategy and / or an advanced state management strategy.
7. A front-end state management device, characterized in that: include: A front-end module acquisition module, used to acquire multiple front-end modules and establish a state container class corresponding to each of the front-end modules; An initial state management strategy acquisition module, used to acquire the initial state management strategy corresponding to each of the front-end modules through each of the state container classes; The state management strategy update module is used to collect the operating parameters of each of the front-end modules in real time according to each of the initial state management strategies. If it is determined based on the current operating parameters that the state management strategy of the current front-end module needs to be updated, the state container class corresponding to the current front-end module is used to determine the updated state management strategy corresponding to the current front-end module according to the current operating parameters.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor, and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the front-end state management method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to enable a processor to implement the front-end state management method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the front-end state management method according to any one of claims 1 to 6 when executed by a processor.
