CN114296855A - User interface state management method and device, electronic equipment and storage medium - Google Patents

User interface state management method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114296855A
CN114296855A CN202111641838.5A CN202111641838A CN114296855A CN 114296855 A CN114296855 A CN 114296855A CN 202111641838 A CN202111641838 A CN 202111641838A CN 114296855 A CN114296855 A CN 114296855A
Authority
CN
China
Prior art keywords
parameter
state value
user interface
target state
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111641838.5A
Other languages
Chinese (zh)
Other versions
CN114296855B (en
Inventor
徐东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202111641838.5A priority Critical patent/CN114296855B/en
Priority claimed from CN202111641838.5A external-priority patent/CN114296855B/en
Publication of CN114296855A publication Critical patent/CN114296855A/en
Application granted granted Critical
Publication of CN114296855B publication Critical patent/CN114296855B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The disclosure provides a state management method and device for a user interface, an electronic device and a storage medium. The method comprises the following steps: the method comprises the following steps: updating a first parameter of state parameters of a user interface based on a simple mode in response to a first operation on the user interface; wherein the simple mode comprises: modifying a first current state value of the first parameter based on a first target state value; the target state value is obtained based on the first operation; comparing the first current state value with the first target state value to monitor whether the first parameter changes; in response to the first parameter changing, sending a first subscription message to a first component subscribing to the first parameter, the first subscription message indicating that the first parameter changing; sending the first target state value to the first component to render the user interface.

Description

User interface state management method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for managing a state of a user interface, an electronic device, and a storage medium.
Background
In the construction of applications (applications), many components (widgets) are usually involved, which have different states (states) at different times in order to display different User Interfaces (UIs). As the number of components and their states increase with the increase of application functionality, a state manager may be employed to manage the states of the components in order to more clearly test and maintain the states of all the components. The state parameters of the component are typically stored in a state container from which the component retrieves the current state values to render the user interface.
However, in the related art, the state manager can only provide a single inherent management mode, and when the state of a component needs to be changed, only a new event can be created, the state value of the current component is combined to calculate the changed state value, the state parameter is updated based on the changed state value, and finally the updated state value is transmitted to the component. In all scenarios, the state of the component needs to be maintained in this natural mode. This makes the state management flow in some simple scenes redundant and cumbersome, reduces the response speed of the service and the development efficiency of the application, and limits the development process to a certain extent, making the development work inflexible.
Disclosure of Invention
In view of the above, an object of the present disclosure is to provide a method, an apparatus, an electronic device and a storage medium for managing a status of a user interface, so as to solve or partially solve the above technical problems.
In a first aspect of the disclosure, a method for managing a state of a user interface includes:
updating a first parameter of state parameters of a user interface based on a simple mode in response to a first operation on the user interface; wherein the simple mode comprises: modifying a first current state value of the first parameter based on a first target state value; the first target state value is obtained based on the first operation;
comparing the first current state value with the first target state value to monitor whether the first parameter changes;
in response to the first parameter changing, sending a first subscription message to a first component subscribing to the first parameter, the first subscription message indicating that the first parameter changing;
sending the first target state value to the first component to render the user interface.
In a second aspect of the present disclosure, a status management apparatus for a user interface is provided, where a status update module is configured to update a first parameter of status parameters of the user interface based on a simple mode in response to a first operation on the user interface; wherein the simple mode comprises: modifying a first current state value of the first parameter based on a first target state value; the first target state value is obtained based on the first operation;
the state monitoring module is used for comparing the first current state value with the first target state value to monitor whether the first parameter changes;
the message subscription module is used for responding to the change of the first parameter and sending a first subscription message to a first component which subscribes to the first parameter, wherein the first subscription message is used for indicating the change of the first parameter;
a state sending module for sending the first target state value to the first component to render the user interface.
In a third aspect of the disclosure, an electronic device is provided, comprising a memory, a processor and a computer program stored on the memory and executable by the processor, the processor implementing the method according to the first aspect when executing the computer program.
In a fourth aspect of the disclosure, a non-transitory computer-readable storage medium is provided, storing computer instructions for causing a computer to perform the method of the first aspect.
As can be seen from the foregoing, the method, the apparatus, the electronic device, and the storage medium for managing the state of the user interface provided by the present disclosure provide a simple mode of state management, which can directly update the state value of the state parameter based on an operation on the user interface, and transmit the state value to the component to render the user interface, thereby implementing a fast update of the state parameter and facilitating an improvement of development efficiency. Meanwhile, in the practical application process of the user interface, the method is also beneficial to improving the response speed to the operation, rapidly updating the user interface and improving the use smoothness of the user interface.
Drawings
In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 shows a schematic diagram of a state management architecture of a user interface of an embodiment of the present disclosure.
Fig. 2 shows a schematic diagram of a general mode of state management of an embodiment of the present disclosure.
FIG. 3 illustrates a schematic diagram of a simple mode of state management of an embodiment of the present disclosure.
FIG. 4 sets forth a flow chart illustrating an exemplary method for state management of a user interface provided by embodiments of the present disclosure.
Fig. 5 shows a flow diagram of a normal mode of an embodiment of the present disclosure.
FIG. 6 illustrates a schematic diagram of mode selection for an embodiment of the present disclosure.
Fig. 7 shows a schematic structural diagram of an exemplary apparatus provided by an embodiment of the present disclosure.
Fig. 8 shows a hardware configuration diagram of an exemplary electronic device of an embodiment of the present disclosure.
Detailed Description
For the purpose of promoting a better understanding of the objects, aspects and advantages of the present disclosure, reference is made to the following detailed description taken in conjunction with the accompanying drawings.
It is to be noted that technical terms or scientific terms used in the embodiments of the present disclosure should have a general meaning as understood by those having ordinary skill in the art to which the present disclosure belongs, unless otherwise defined. The use of "first," "second," and similar terms in the embodiments of the disclosure is not intended to indicate any order, quantity, or importance, but rather to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element or item listed before the word covers the element or item listed after the word and its equivalents, but does not exclude other elements or items. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used merely to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
FIG. 1 shows a schematic diagram of a state management architecture of a user interface of an embodiment of the present disclosure. Referring to FIG. 1, the state management architecture 100 may include a server 110, a client 120, and a communication network 130 that provides communication links. The server 110 and the client 120 may be connected via a wired or wireless communication network 130. The server 110 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN, a big data and artificial intelligence platform, and the like.
Client 120 may be a hardware or software implementation. For example, when the client 120 is implemented in hardware, it may be various electronic devices having a display screen and supporting page display, including but not limited to a smart phone, a tablet computer, an e-book reader, a laptop portable computer, a desktop computer, and the like. When the client 120 device is implemented in software, it may be installed in the electronic devices listed above; it may be implemented as a plurality of software or software modules (for example, software or software modules for providing distributed services), or may be implemented as a single software or software module, which is not specifically limited herein.
It should be noted that the method for managing the state of the user interface provided in the embodiment of the present application may be executed by the client 120 or by the server 110. It should be understood that the number of clients, networks, and servers in FIG. 1 is illustrative only and is not intended to be limiting. There may be any number of clients, networks, and servers, as desired for an implementation.
An increasing number of developers and organizations employ Flutter to build user interfaces. Flutter is a mobile UI framework that separates data from views, renders the views from data maps, and can quickly build high quality user interfaces. Redox is a JavaScript state container that provides predictable state management. The use of Redox in Flutter allows the state of the user interface to be efficiently managed, allowing the state of all components to be more clearly tested and maintained.
Redux can provide developers with a common mode of state management, as shown in FIG. 2, a schematic diagram of the common mode of state management according to an embodiment of the present disclosure is shown in FIG. 2. In fig. 2, the user interface 201 includes at least one control, such as a play control for controlling whether to start playing in the play interface. The user may perform a second operation 202 on the user interface 201, and the second operation 202 may be an operation on a control in the user interface 201, such as clicking a control or double clicking a control. In response to this second operation 202, an event generating function (Action Creator)203 may be invoked to generate a target event (Action) X within which a string type "field may be used to indicate an Action to be performed. The event generating function 203 calls a dispatch function, e.g., Store. dispatch (action), to send the target event X to the state object 205(Store) in the state container 204 (reduce). The state object 205 may be a state tree formed of all state parameters of the user interface 201, each node of the state tree corresponding to a state parameter and storing a current state value of the state parameter. Operation 202 may cause a change in the second parameter state2 in the state object 205. The state container 204 further includes a Reducer 207(Reducer), the state object 205 transfers the second current state value 206 and the target event X associated with the second parameter state2 into the Reducer 207, the Reducer 207 calculates a second target state value 208 based on the second current state value 206 and the target event X, and returns the second target state value 208 to the state object 205 to update the second parameter state2 in the state object 205. What is stored in the second parameter state2 node of the updated state object 205 is the second target state value 208.
The second component 209 for rendering the user interface 201 calls the subscribe function to subscribe to the second parameter state2 to monitor whether the second parameter state2 has changed. Once the subscribe function detects that the second parameter state2 has changed, a second subscription message 210 is sent to the second component 209, where the second subscription message 210 may indicate that the state value of the second parameter state2 has changed. The second component 209, upon receiving the second subscription message 210, calls the getstate function to obtain the current state value of the required second parameter state2 from the state object 205, where the current state value of the second parameter state2 is the updated second target state value 208. The second component 209, upon receiving the second target state value 208, renders the updated user interface 201 with the second target state value, and implements the functionality of the second operation 202.
In practical applications, the state update of the user interface implemented according to the common mode of the above embodiment includes more specific special codes, such as an event (Action) and a Reducer (Reducer), which all have respective specific formats. And each operation on the user interface requires re-registration of an event and corresponding reducer. For some simple operations, such as clicking a play button in a play interface to play data, the adoption of a common mode is redundant and tedious, and the response speed of the service is reduced; or a simple application scenario, for example, a developer constructs a demo interface, which may not need to be tested, and the development efficiency of the developer is reduced by using a common mode, and the flexibility of the development process is limited by the single mode.
Based on the above consideration, according to the embodiment of the present disclosure, on the premise of not changing the original Redox framework, a simple mode state management manner is added, the state value of the state parameter can be directly updated based on the operation for the user interface, and the state value is transferred to the component to render the user interface, so that the state parameter is quickly updated, and the development efficiency of the user interface in application is improved. Meanwhile, in the practical application process of the user interface, the method is also beneficial to improving the response speed to the operation, rapidly updating the user interface and improving the use smoothness of the user interface. The developer can select to adopt a simple mode or a common mode according to the requirement, and the two modes exist independently and are not mutually exclusive. For the same operation, the simple mode can be selected to maintain the state of the user interface, the common mode can be selected to maintain the state of the user interface, and the simple mode and the common mode can be both used to maintain the state of the user interface.
As shown in fig. 3, a schematic and schematic diagram of a simple mode of state management according to an embodiment of the present disclosure is shown in fig. 3. In fig. 3, user interface 301 may refer to user interface 201 in fig. 2. The user may perform a first operation 302 with respect to the user interface 301, which first operation 302 may also be referred to as operation 202 in fig. 2. In response to this first operation 302, a modify function of the state object 305 (which may refer to the state object 205 in fig. 2) may be invoked to modify the first current state value 306 of the first parameter state 1. For example, the user interface 301 is a player interface, the operation 302 is to click a play control to play video data, before the operation 302 is executed, the user interface 301 is in an unplayed state, that is, the first parameter state1 is playing, and the first current state value thereof is false, that is, playing is false; after performing operation 302, a modification function may be directly invoked to modify the first current state value of the first state parameter playing to the first target state value 307, i.e., playing true, for example, store.
Wherein the first target state value 307 may be derived based on the first operation 302. In a specific implementation, the modify function may be implemented by using a packaged preset modification event and a corresponding preset reducer. The first operation 302 may directly trigger a built-in preset Modification event 303, and the preset Modification event 303 may be a pre-registered defined event indicating a Modification action, such as Modification (). The default Reducer 304 corresponding to the default Modification event 303 may also be defined by pre-registration, such as a Modification Reducer. The default reducer 304 calculates a first target state value 307 based on the default modification event 303 and the first parameter state1, and returns to the state object 305 to update the first current state value 306 of the first parameter state 1. For example, the first operation 302 is to click the play control to play the video data, and before the first operation 302 is executed, the first current state value 306 of the first parameter playing is false, that is, playing is false. If the user executes a second operation 302 on the user interface 301, a preset modification event 303 is triggered; the preset subtractor 304 corresponding to the preset modification event 303 obtains a first target state value 307 of playing true based on the first current state value 306 of playing false and the preset modification event; and returns the first target state value 307 to the state object 305 to update the first parameter playing, where the current state value of the first parameter playing is playing true, thereby implementing playing of video data and state update of the user interface.
The first component 309 calls the subscribe function to subscribe to the first parameter state1 to monitor whether the first parameter state1 has changed. The first component 309 may refer to the second component 209 in fig. 2, and once the script function detects that the first parameter state1 has changed, a first subscription message 308 is sent to the first component 309, and the first subscription message 308 may indicate that the current state value of the first parameter state1 has changed. Upon receiving the first subscription message 308, the first component 209 invokes the getstate function of the state object 305 to obtain the current state value of the first parameter state1 from the state object 305, where the current state value of the first parameter state1 in the state object 305 is the first target state value 307. The first component 309, upon receiving the first target state value 307, renders the updated user interface 301 with the first target state value 307, implementing the functionality of operation 302. For example, the updated user interface 301 is rendered according to the first target state value 307 "playing ═ true" to display a user interface for playing video data.
Compared with the common mode in fig. 2, the simple mode in fig. 3 is more advantageous for application of simple operations or simple scenes, uses predefined actions and reducers without the need for developers to define the actions and the reducers themselves, can directly update the state values of the state parameters based on operations on the user interface, and transmits the state values to the components to render the user interface, thereby realizing rapid update of the state parameters and being beneficial to improvement of development efficiency. Meanwhile, in the practical application process of the user interface, the method is also beneficial to improving the response speed to the operation, rapidly updating the user interface and improving the use smoothness of the user interface.
The embodiment of the disclosure provides a state management method for a user interface. FIG. 4 illustrates a flowchart of an exemplary method 400 of state management of a user interface provided by an embodiment of the present disclosure. The method 400 may be applied to the client 120 or the server 110 of fig. 1, and may further include the following steps.
At step 410, in response to a first operation (e.g., first operation 302 in fig. 3) on a user interface (e.g., user interface 301 in fig. 3), updating a first parameter (e.g., first parameter state1 in the embodiment illustrated in fig. 3) of state parameters of the user interface based on a simple mode; wherein the simple mode comprises: modifying a first current state value (e.g., first current state value 306 in FIG. 3) of the first parameter based on a first target state value (e.g., first target state value 307 in FIG. 3); the first target state value is obtained based on the first operation.
In step 420, the first current state value and the first target state value are compared to monitor whether the first parameter has changed.
At step 430, in response to the first parameter changing, a first subscription message (e.g., the first subscription message 308 in fig. 3) is sent to a first component (e.g., the first component 309 in fig. 3) subscribing to the first parameter, where the first subscription message is used to indicate that the first parameter changing.
At step 440, the first target state value is sent to the first component to render the user interface.
In some embodiments, as shown in fig. 3, the first target state value is derived based on the first operation, including:
triggering a preset modification event (e.g., preset modification event 303 in fig. 3) based on the first operation;
the first target state value is generated based on the preset modification event and a corresponding preset decrementer (e.g., preset decrementer 304 in fig. 3).
In some embodiments, as shown in fig. 5, fig. 5 shows a flow diagram of a generic mode according to an embodiment of the present disclosure. In fig. 5, the method 400 further includes:
at step 450, in response to a second operation (e.g., the second operation 202 in fig. 2) on a user interface (e.g., the user interface 201 in fig. 2), updating a second parameter (e.g., the second parameter state2 in the embodiment described in fig. 2) of the state parameters of the user interface based on the normal mode; wherein the normal mode includes:
generating a target event (e.g., target event X in fig. 2) based on the second operation;
invoking a decrementer (e.g., decrementer 207 in FIG. 2) to determine a second target state value (e.g., second target state value 208 in FIG. 2) for the second parameter based on the second current state value (e.g., second current state value 206 in FIG. 2) for the second parameter and the target event;
at step 460, updating the second parameter based on the second target state value;
comparing, at step 470, the second current state value and the second target state value to monitor whether the second parameter has changed;
at step 480, in response to the second parameter changing, sending a second subscription message (e.g., second subscription message 210 in fig. 2) to a second component (e.g., second component 209 in fig. 2) subscribing to the second parameter, the second subscription message indicating that the second parameter changing;
at step 490, the second target state value is sent to the second component to render the user interface.
In some embodiments, the method 400 further comprises:
in response to a user selecting the simple mode for the first operation, configuring the first operation to update the first parameter in the simple mode;
and in response to a user selecting the normal mode for the second operation, configure the second operation to update the second parameter in the normal mode.
According to an embodiment of the present disclosure, as shown in fig. 6, fig. 6 shows a schematic diagram of mode selection according to an embodiment of the present disclosure. In FIG. 6, two modes of state management for the user interface are provided: a simple mode 610 (shown by the dashed box) and a normal mode 620 (shown by the solid box). The simple schema 610 may directly modify the state parameter to the first goal state value (e.g., the first goal state value 307 in FIG. 3) via a store (e.g., the state object 305 in FIG. 3) when a change is to occur in the user interface. Normal mode 620 may distribute an action (e.g., target event X in FIG. 2) via a store (e.g., state object 205 in FIG. 2) when a user interface change is to occur, and determine a second target state value (e.g., second target state value 208 in FIG. 2) via a reducer. Both the simple mode 610 and the normal mode 620 render a user interface (e.g., user interface 301 in fig. 3, user interface 201 in fig. 2) based on the updated target state value (e.g., first target state value 307 in fig. 3, second target state value 208 in fig. 2). The simple mode 610 and the common mode 620 can be selected by developers at will, and flexibility of the development process is improved. For example, a simple mode may be used for simple operations or simple scenes, and a normal mode may be used for more complex scenes to manage the state of the user interface. Thus, different modes can be set for different situations, which is beneficial to improving the development efficiency.
In some embodiments, the method 400 further comprises:
in response to the number of first parameters being less than a threshold, configure the first operation to update the first parameters in the simple mode;
and in response to the number of second parameters being greater than or equal to the threshold, configure the second operation to update the second parameters in the normal mode.
And the mode of state management can be automatically configured according to the characteristics of each operation, so that the development efficiency is further improved. The number of the state parameters which are changed in the user interface caused by a certain operation can be adopted, if the changed state parameters are less and less than a preset threshold value, the operation can be regarded as simple operation, and correspondingly, the operation can be configured into a simple mode; if the changed state parameters are more than the preset threshold, the operation can be considered as more complex operation, and correspondingly, the operation can be configured to be in a common mode. The first parameter may be a state parameter of a change in the user interface caused by the first operation, and the second parameter may be a state parameter of a change in the user interface caused by the second operation. If the number of the first parameters is less than the threshold value, the corresponding first operation can be configured to be a simple mode; if the number of the second parameters is greater than or equal to the threshold, the corresponding second operation can be configured to be in a normal mode.
In some embodiments, the first operation and the second operation are the same, the first parameter and the second parameter are the same, and the first target state value and the second target state value are the same.
Because the simple mode and the common mode do not have mutual exclusion relationship, the two modes can be mixed and used not only for different operations. The two modes can be mixed and used simultaneously for the same operation, and at the moment, the state parameters related to the two modes and the updated target state value should be the same, so that the same management on the state parameters is ensured for the same operation.
In some embodiments, the first operation and/or the second operation comprises: and operating a control in the user interface or changing the operation parameters of the user interface.
The operation of changing the operation parameters of the user interface may refer to an operation of changing an operation environment of the user interface, for example, when the user interface is a player interface, and when a terminal of the user interface is scheduled to change, the display of the player interface changes from a landscape screen to a portrait screen or from a portrait screen to a landscape screen.
The embodiment of the method 400 of the above embodiment may have the beneficial effects of the corresponding embodiments of the foregoing normal mode and/or the foregoing simple mode, and is not described herein again.
It should be noted that the method of the embodiments of the present disclosure may be executed by a single device, such as a computer or a server. The method of the embodiment can also be applied to a distributed scene and completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the devices may only perform one or more steps of the method of the embodiments of the present disclosure, and the devices may interact with each other to complete the method.
It should be noted that the above describes some embodiments of the disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments described above and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Based on the same inventive concept, corresponding to the method of any embodiment, the disclosure also provides a state management device of the user interface. Fig. 7 illustrates a schematic structural diagram of an exemplary apparatus 700 provided by an embodiment of the present disclosure.
Referring to fig. 7, the state management apparatus 700 of the user interface may include:
a status update module 710 configured to: updating a first parameter of state parameters of a user interface based on a simple mode in response to a first operation on the user interface; wherein the simple mode comprises: modifying a first current state value of the first parameter based on a first target state value; the first target state value is obtained based on the first operation;
a status monitoring module 720 configured to: comparing the first current state value with the first target state value to monitor whether the first parameter changes;
a message subscription module 730 configured to: in response to the first parameter changing, sending a first subscription message to a first component subscribing to the first parameter, the first subscription message indicating that the first parameter changing;
a status sending module 740 configured to: sending the first target state value to the first component to render the user interface.
In some embodiments, the status update module 710 is configured to: triggering a preset modification event based on the first operation; generating the first target state value based on the preset modification event and a corresponding preset reducer.
In some embodiments, the status update module 710 is configured to: updating a second parameter of the state parameters of the user interface based on a normal mode in response to a second operation for the user interface; wherein the normal mode includes: generating a target event based on the second operation; invoking a decrementer to determine a second target state value for the second parameter based on a second current state value for the second parameter and the target event; updating the second parameter based on the second target state value;
a status monitoring module 720 configured to: comparing the second current state value with the second target state value to monitor whether the second parameter changes;
a message subscription module 730 configured to: in response to the second parameter changing, sending a second subscription message to a second component subscribing to the second parameter, where the second subscription message is used to indicate that the second parameter changing;
a status sending module 740 configured to: sending the second target state value to the second component to render the user interface.
In some embodiments, the apparatus 700 further comprises:
a mode selection module 750 configured to: in response to a user selecting the simple mode for the first operation, configuring the first operation to update the first parameter in the simple mode;
and in response to a user selecting the normal mode for the second operation, configure the second operation to update the second parameter in the normal mode.
In some embodiments, the apparatus 700 further comprises:
a mode self-configuration module 750 configured to: in response to the number of first parameters being less than a threshold, configure the first operation to update the first parameters in the simple mode;
and in response to the number of second parameters being greater than or equal to the threshold, configure the second operation to update the second parameters in the normal mode.
In some embodiments, the first operation and the second operation are the same, the first parameter and the second parameter are the same, and the first target state value and the second target state value are the same.
In some embodiments, the first operation and/or the second operation comprises: and operating a control in the user interface or changing the operation parameters of the user interface.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the various modules may be implemented in the same one or more software and/or hardware implementations of the present disclosure.
The apparatus of the foregoing embodiment is used to implement the state management method of the corresponding user interface in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to any of the above embodiments, the present disclosure further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the program to implement the method for managing the state of the user interface according to any of the above embodiments.
Fig. 8 shows a hardware structure of a more specific electronic device 800 provided in this embodiment. The device 800 may be used to implement the client 120 of fig. 1. The apparatus 800 may further comprise: a processor 802, a memory 804, an input/output interface 806, a communication interface 808, and a bus 810. Wherein the processor 802, memory 804, input/output interface 806, and communication interface 808 are communicatively coupled to each other within the device via a bus 810.
The processor 802 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 804 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 804 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 804 and called to be executed by the processor 802.
The input/output interface 806 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 808 is used for connecting a communication module (not shown in the figure) to implement communication interaction between the present device and other devices. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 810 includes a path that transfers information between various components of the device, such as processor 802, memory 804, input/output interface 806, and communication interface 808.
It should be noted that although the above-described device only shows the processor 802, the memory 804, the input/output interface 806, the communication interface 808 and the bus 810, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The electronic device of the foregoing embodiment is used to implement the state management method of the corresponding user interface in any one of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to any of the above-described embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method for managing a state of a user interface according to any of the above-described embodiments.
Computer-readable media of the present embodiments, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
The computer instructions stored in the storage medium of the foregoing embodiment are used to enable the computer to execute the method for managing the state of the user interface according to any embodiment, and have the beneficial effects of corresponding method embodiments, which are not described herein again.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the idea of the present disclosure, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of brevity.
In addition, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown in the provided figures for simplicity of illustration and discussion, and so as not to obscure the embodiments of the disclosure. Furthermore, devices may be shown in block diagram form in order to avoid obscuring embodiments of the present disclosure, and this also takes into account the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the embodiments of the present disclosure are to be implemented (i.e., specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the disclosure, it should be apparent to one skilled in the art that the embodiments of the disclosure can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative instead of restrictive.
While the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic ram (dram)) may use the discussed embodiments.
The disclosed embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalents, improvements, and the like that may be made within the spirit and principles of the embodiments of the disclosure are intended to be included within the scope of the disclosure.

Claims (10)

1. A method for managing a state of a user interface, comprising:
updating a first parameter of state parameters of a user interface based on a simple mode in response to a first operation on the user interface; wherein the simple mode comprises: modifying a first current state value of the first parameter based on a first target state value; the first target state value is obtained based on the first operation;
comparing the first current state value with the first target state value to monitor whether the first parameter changes;
in response to the first parameter changing, sending a first subscription message to a first component subscribing to the first parameter, the first subscription message indicating that the first parameter changing;
sending the first target state value to the first component to render the user interface.
2. The method of claim 1, wherein the first target state value is derived based on the first operation, comprising:
triggering a preset modification event based on the first operation;
generating the first target state value based on the preset modification event and a corresponding preset reducer.
3. The method of claim 1, further comprising:
updating a second parameter of the state parameters of the user interface based on a normal mode in response to a second operation for the user interface; wherein the normal mode includes:
generating a target event based on the second operation;
invoking a decrementer to determine a second target state value for the second parameter based on a second current state value for the second parameter and the target event;
updating the second parameter based on the second target state value;
comparing the second current state value with the second target state value to monitor whether the second parameter changes;
in response to the second parameter changing, sending a second subscription message to a second component subscribing to the second parameter, where the second subscription message is used to indicate that the second parameter changing;
sending the second target state value to the second component to render the user interface.
4. The method of claim 3, further comprising:
in response to a user selecting the simple mode for the first operation, configuring the first operation to update the first parameter in the simple mode;
and in response to a user selecting the normal mode for the second operation, configure the second operation to update the second parameter in the normal mode.
5. The method of claim 3, further comprising: the first operation and the second operation are the same, the first parameter and the second parameter are the same, and the first target state value and the second target state value are the same.
6. The method of claim 3, further comprising:
in response to the number of first parameters being less than a threshold, configure the first operation to update the first parameters in the simple mode;
and in response to the number of second parameters being greater than or equal to the threshold, configure the second operation to update the second parameters in the normal mode.
7. The method of claim 3, wherein the first operation and/or the second operation comprises: and operating a control in the user interface or changing the operation parameters of the user interface.
8. A state management apparatus of a user interface, comprising:
the state updating module is used for responding to a first operation aiming at the user interface and updating a first parameter in the state parameters of the user interface based on a simple mode; wherein the simple mode comprises: modifying a first current state value of the first parameter based on a first target state value; the first target state value is obtained based on the first operation;
the state monitoring module is used for comparing the first current state value with the first target state value to monitor whether the first parameter changes;
the message subscription module is used for responding to the change of the first parameter and sending a first subscription message to a first component which subscribes to the first parameter, wherein the first subscription message is used for indicating the change of the first parameter;
a state sending module for sending the first target state value to the first component to render the user interface.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 7 when executing the program.
10. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 7.
CN202111641838.5A 2021-12-29 State management method and device of user interface, electronic equipment and storage medium Active CN114296855B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111641838.5A CN114296855B (en) 2021-12-29 State management method and device of user interface, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111641838.5A CN114296855B (en) 2021-12-29 State management method and device of user interface, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114296855A true CN114296855A (en) 2022-04-08
CN114296855B CN114296855B (en) 2024-04-30

Family

ID=

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116088938A (en) * 2023-04-12 2023-05-09 摩尔线程智能科技(北京)有限责任公司 Continuous instruction processing method and system, electronic equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030135382A1 (en) * 2002-01-14 2003-07-17 Richard Marejka Self-monitoring service system for providing historical and current operating status
US20090019146A1 (en) * 2007-07-13 2009-01-15 Invensys Systems, Inc. Associating and evaluating status information for a primary input parameter value from a profibus device
US20140281891A1 (en) * 2013-03-15 2014-09-18 Bmc Software, Inc. Configurable user inteface interactions using a state machine combined with event orchestration
CN106250128A (en) * 2016-07-26 2016-12-21 网易(杭州)网络有限公司 The display processing method of user interface and device
CN108304236A (en) * 2017-12-28 2018-07-20 天津麒麟信息技术有限公司 User interface method for refreshing based on message subscribing under a kind of cloud platform
CN110020371A (en) * 2017-12-26 2019-07-16 航天信息股份有限公司 A kind of method and device based on the linkage of react-native page layout
US20190324729A1 (en) * 2018-04-24 2019-10-24 Microsoft Technology Licensing, Llc Web Application Development Using a Web Component Framework
US20200272705A1 (en) * 2019-02-21 2020-08-27 Abb Schweiz Ag Method and System for Automated Gear Reducer Design
CN112579686A (en) * 2019-09-30 2021-03-30 北京国双科技有限公司 Interaction method, interaction device, storage medium and electronic equipment
CN113110889A (en) * 2021-04-16 2021-07-13 北京沃东天骏信息技术有限公司 Global message prompting method, global message prompting device, medium and electronic equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030135382A1 (en) * 2002-01-14 2003-07-17 Richard Marejka Self-monitoring service system for providing historical and current operating status
US20090019146A1 (en) * 2007-07-13 2009-01-15 Invensys Systems, Inc. Associating and evaluating status information for a primary input parameter value from a profibus device
US20140281891A1 (en) * 2013-03-15 2014-09-18 Bmc Software, Inc. Configurable user inteface interactions using a state machine combined with event orchestration
CN106250128A (en) * 2016-07-26 2016-12-21 网易(杭州)网络有限公司 The display processing method of user interface and device
CN110020371A (en) * 2017-12-26 2019-07-16 航天信息股份有限公司 A kind of method and device based on the linkage of react-native page layout
CN108304236A (en) * 2017-12-28 2018-07-20 天津麒麟信息技术有限公司 User interface method for refreshing based on message subscribing under a kind of cloud platform
US20190324729A1 (en) * 2018-04-24 2019-10-24 Microsoft Technology Licensing, Llc Web Application Development Using a Web Component Framework
US20200272705A1 (en) * 2019-02-21 2020-08-27 Abb Schweiz Ag Method and System for Automated Gear Reducer Design
CN112579686A (en) * 2019-09-30 2021-03-30 北京国双科技有限公司 Interaction method, interaction device, storage medium and electronic equipment
CN113110889A (en) * 2021-04-16 2021-07-13 北京沃东天骏信息技术有限公司 Global message prompting method, global message prompting device, medium and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116088938A (en) * 2023-04-12 2023-05-09 摩尔线程智能科技(北京)有限责任公司 Continuous instruction processing method and system, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11144711B2 (en) Webpage rendering method, device, electronic apparatus and storage medium
US10542122B2 (en) Event service for local client applications through local server
BR112021009629A2 (en) method of processing user interface content, system, and non-transient computer readable media
KR101198437B1 (en) Method, apparatus and computer program product for providing context triggered distribution of context models
WO2020220773A1 (en) Method and apparatus for displaying picture preview information, electronic device and computer-readable storage medium
US9906626B2 (en) Resource demand-based network page generation
CN111064626B (en) Configuration updating method, device, server and readable storage medium
AU2012322684B2 (en) Event service for local client applications through local server
US20200125631A1 (en) Extensible Grid Layout
CN112235132B (en) Method, device, medium and server for dynamically configuring service
CN112764746B (en) Data processing method, device, electronic equipment and storage medium
Chmielewski et al. Application architectures for smart multi-device applications
CN114296855B (en) State management method and device of user interface, electronic equipment and storage medium
CN114296855A (en) User interface state management method and device, electronic equipment and storage medium
CN113709171B (en) Method and device for cross-component state communication
CN112966201B (en) Object processing method, device, electronic equipment and storage medium
CN114968225A (en) Micro-service unified construction method, environment generation method and related equipment
CN116775174A (en) Processing method, device, equipment and medium based on user interface frame
US10795698B2 (en) User interface based on metadata
CN111813407B (en) Game development method, game running device and electronic equipment
US11853775B1 (en) Systems and methods for providing nested frontend applications for managed service providers
CN114157917B (en) Video editing method and device and terminal equipment
KR101929201B1 (en) Method and apparatus for structuring component that supports n-screen using single code in business application
CN117914721A (en) Java-based call substitute service system construction method and device
CN117389438A (en) Page display method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant