CN116795568A - Application event processing method and device, electronic equipment and storage medium - Google Patents

Application event processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116795568A
CN116795568A CN202310792794.9A CN202310792794A CN116795568A CN 116795568 A CN116795568 A CN 116795568A CN 202310792794 A CN202310792794 A CN 202310792794A CN 116795568 A CN116795568 A CN 116795568A
Authority
CN
China
Prior art keywords
application
target
event type
model object
event
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.)
Pending
Application number
CN202310792794.9A
Other languages
Chinese (zh)
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 QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202310792794.9A priority Critical patent/CN116795568A/en
Publication of CN116795568A publication Critical patent/CN116795568A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention provides a processing method and device of application events, electronic equipment and a computer readable storage medium, and belongs to the technical field of data processing. The method comprises the following steps: responding to user operation aiming at an application program, and acquiring a target event type corresponding to the user operation; acquiring each model object in the application program, wherein each model object is configured with an entry protocol; matching the entry protocol with the target event type, and selecting a target model object corresponding to the target event type from the model objects according to a matching result; and running an application function corresponding to the target model object to respond to the user operation.

Description

Application event processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method for processing an application event, a device for processing an application event, an electronic device, and a computer readable storage medium.
Background
The Flutter is an open-source tool kit for constructing a user interface, which can help a developer to efficiently construct application interfaces applicable to different platforms through a set of code libraries and support mobile, web, desktop and embedded platforms. Among them, for the on-line Flutter in the application program, the developer often does not spend a great deal of effort to reconstruct the whole project by adopting the Flutter, but carries out mixed-editing processing on the Flutter and Native so as to reduce the corresponding development cost.
For event processing between the router and Native, when a new event type needs to be added, a corresponding service class needs to be added, a reference relation between the event type and the service class needs to be configured in the event processor, so that the burden of development of an application program project is easily increased, meanwhile, a large number of parameters are involved in calling between different service classes, the difficulty of project development is improved, and in the case of triggering an event, the service class needs to be positioned, and in the positioning process, the readability of a bottom code is poor due to the existence of a large number of branches (the reference relation between the event type and the service class), and the difficulty of project development is further increased.
Disclosure of Invention
The invention provides a processing method and device of application events, electronic equipment and a computer readable storage medium, so as to solve the problems of high cost and high difficulty in the development and maintenance processes of application program projects to a certain extent.
According to a first aspect of the present invention, there is provided a method of processing an application event, the method comprising:
responding to user operation aiming at an application program, and acquiring a target event type corresponding to the user operation;
Acquiring each model object in the application program, wherein each model object is configured with an entry protocol;
matching the entry protocol with the target event type, and selecting a target model object corresponding to the target event type from the model objects according to a matching result;
and running an application function corresponding to the target model object to respond to the user operation.
Optionally, the responding to the user operation for the application program obtains a target event type corresponding to the user operation, including:
responding to user operation aiming at an application page in an application program, capturing an application event triggered by the user operation through a Fluter layer of the application page, and transmitting the application event to a Native layer of the application page;
and acquiring the target event type of the application event through the Native layer.
Optionally, the matching the entry protocol with the target event type, selecting a target model object corresponding to the target event type from the model objects according to a matching result, including:
acquiring a first event type returned by an entry protocol of each model object through the Native layer;
Characterizing a first event type which is the same as the target event type as a second event type through the Native layer, and taking an entry protocol to which the second event type belongs as a target entry protocol;
and taking the model object to which the target entry protocol belongs as a target model object corresponding to the target event type through the Native layer.
Optionally, the entry protocol includes an event type returning method, and the acquiring, by the Native layer, a first event type returned by the entry protocol of each model object includes:
and executing an event type returning method in each entry protocol through the Native layer to obtain a first event type corresponding to each model object.
Optionally, the portal protocol includes an object calling method, and the running the application function corresponding to the target model object in response to the user operation includes:
executing an object calling method of the target entry protocol through the Native layer to obtain target application parameters of the target model object, and transmitting the target application parameters to the router layer;
and running an application function corresponding to the target model object according to the target application parameter through the router layer so as to respond to the user operation.
Optionally, the model object is generated by:
acquiring a service class corresponding to an application function and a plurality of original application parameters of the service class;
combining original application parameters of the same parameter type to obtain a plurality of standard application parameters corresponding to the service class, wherein the number of the standard application parameters is smaller than that of the original parameters;
and taking each standard application parameter as an object attribute, and creating a model object corresponding to the service class based on the object attribute.
Optionally, the standard application parameters at least comprise page type, event content, event supplement parameters, view controller, callback result and event type; each of the model objects corresponds to a business class.
According to a second aspect of the present invention, there is provided an apparatus for processing an application event, the apparatus comprising:
the event type acquisition module is used for responding to the user operation aiming at the application program and acquiring a target event type corresponding to the user operation;
the object acquisition module is used for acquiring each model object in the application program, and each model object is configured with an entry protocol;
The object matching module is used for matching the entry protocol with the target event type, and selecting a target model object corresponding to the target event type from the model objects according to a matching result;
and the function running module is used for running the application function corresponding to the target model object to respond to the user operation.
Optionally, the event type acquisition module is specifically configured to:
responding to user operation aiming at an application page in an application program, capturing an application event triggered by the user operation through a Fluter layer of the application page, and transmitting the application event to a Native layer of the application page;
and acquiring the target event type of the application event through the Native layer.
Optionally, the object matching module is specifically configured to:
acquiring a first event type returned by an entry protocol of each model object through the Native layer;
characterizing a first event type which is the same as the target event type as a second event type through the Native layer, and taking an entry protocol to which the second event type belongs as a target entry protocol;
and taking the model object to which the target entry protocol belongs as a target model object corresponding to the target event type through the Native layer.
Optionally, the entry protocol includes an event type return method, and the object matching module is specifically configured to:
and executing an event type returning method in each entry protocol through the Native layer to obtain a first event type corresponding to each model object.
Optionally, the entry protocol includes an object calling method, and the function operation module is specifically configured to:
executing an object calling method of the target entry protocol through the Native layer to obtain target application parameters of the target model object, and transmitting the target application parameters to the router layer;
and running an application function corresponding to the target model object according to the target application parameter through the router layer so as to respond to the user operation.
Optionally, the model object is generated by:
the service class acquisition module is used for acquiring a service class corresponding to an application function and a plurality of original application parameters of the service class;
the parameter combination module is used for combining original application parameters with the same parameter type into standard application parameters to obtain a plurality of standard application parameters corresponding to the service class, wherein the number of the standard application parameters is smaller than that of the original parameters;
And the object creation module is used for taking each standard application parameter as an object attribute and creating a model object corresponding to the service class based on the object attribute.
Optionally, the standard application parameters at least comprise page type, event content, event supplement parameters, view controller, callback result and event type; each of the model objects corresponds to a business class.
According to a third aspect of the invention, an electronic device comprises:
one or more processors; and
one or more machine readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform the method of processing application events of any of the first aspects.
According to a fourth aspect of the present invention, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of processing an application event as described in any of the first aspects.
Aiming at the prior art, the invention has the following advantages:
in the embodiment of the invention, for an application program, a target event type corresponding to user operation can be obtained in response to the user operation aiming at the application program, meanwhile, each model object in the application program can be obtained, each model object is configured with an entry protocol, each model object is associated with an application function of the application program, then the entry protocol of each model object can be matched with the target event type, the target model object corresponding to the target event type is selected from each model object according to a matching result, then the application function corresponding to the target model object is operated to respond to the user operation, thus, in the process of needing to operate the application function corresponding to the user operation, the model object is selected through the matching result between the entry protocol and the event type, the reference relation related to a service class is not required to be configured in the application program, the data structure of the application program is optimized, the memory size of the application program is reduced, and for an application developer, only the model object, the entry protocol and the like are required to be maintained, the difficulty of application development and maintenance is reduced, and the development and maintenance cost is reduced.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
FIG. 1 is a flow chart of steps of an embodiment of a method for processing an application event according to the present invention;
FIG. 2 is a schematic diagram of a model object provided in an embodiment of the present invention;
FIG. 3 is a schematic flow chart of event triggering provided in an embodiment of the present invention;
fig. 4 is a block diagram illustrating an embodiment of a processing apparatus for application events according to the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
As an example, for event handling between Flutter and Native, flutter notifies Native to handle events, typically through FlutterEventChannel (full duplex communication of Flutter), and then specific traffic is distributed by event handler responses. In the event processor, a mapping relation between event types and service types is configured, and each time an event type is added, a corresponding service type needs to be added, and a mapping relation between the service type and the event type needs to be built, so that when an application event is triggered, an application program firstly determines the event type through the event processor, then matches the event type with the mapping relation through the event processor (a switch value is calculated through a switch-case and then matches with the case, and a service type needing to be executed is determined), a target service type corresponding to the triggered event is selected according to a matching result, and then a corresponding application function is operated based on the target service type to respond to the triggered application event. Meanwhile, in the process of calling each service class by the application program to run the corresponding application function, the application program needs to call the different service classes based on different modes due to the difference of data structures among the different service classes, namely the call inlets of the service classes are inconsistent.
Therefore, in the above process, for the application program, a new service class needs to be added every time an event type is newly added, and the calling modes of the service classes cannot be unified, so that a large number of redundant parameters are easily caused in the application program; for the event processor, the service class and the reference relation between the service class and the event type need to be defined in the event processor, so that the size of an application program data packet is increased, and meanwhile, when an application event is triggered, the event processor needs to match the service class through a switch-case, and because the switch-case grammar structure comprises a large number of branches, the readability of the bottom code of the application program is poor, and the development and maintenance cost is increased.
In this regard, in the embodiment of the present invention, for an application program, a target event type corresponding to a user operation may be obtained in response to the user operation for the application program, and meanwhile, each model object in the application program may be obtained, each model object is configured with an entry protocol, each model object is associated with an application function of the application program, then, the entry protocol of each model object may be matched with the target event type, and according to a matching result, a target model object corresponding to the target event type may be selected from each model object, then, an application function corresponding to the target model object may be operated in response to the user operation, so that a matching result between the entry protocol and the event type may be used to select the model object, a reference relation related to a service class may not be configured in the application program, so that a memory size of the application program may be reduced, and for an application developer, after optimizing a data structure of the application program by the model object and the entry protocol, a switch-case control syntax structure may not be added in the application program, thereby improving readability of the application program, reducing a control flow structure such as a control flow in the application program, and maintaining the application program may be performed in the application program, and reducing the development difficulty of the application program may be reduced, and maintenance may be performed in the development process.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a method for processing an application event according to the present invention may specifically include the following steps:
step 101, responding to user operation for an application program, and acquiring a target event type corresponding to the user operation;
classes, which may be a type of user-defined reference data, also referred to as class types, each contain a data specification and a set of functions that operate on data or transfer messages. The service class may be a class corresponding to an application function (or a service) provided by the application program (including a data description, an operation data, or a function for transferring information corresponding to the application function), and when a user inputs a corresponding user operation in the application program, the application program may invoke the corresponding service class based on an event type corresponding to the user operation, so as to execute feedback corresponding to the user operation. The application event may be an event corresponding to an application function executed by a user operation input by a user in the application program, for example, a page jump event, a page slide event, a sign-in event, etc.; the event type may be information identifying an application event, as the invention is not limited in this regard.
In a specific implementation, the application page includes a plurality of different interactive controls, the different interactive controls correspond to different application events, when the application program is used, a user can trigger the interactive controls by inputting user operations for the interactive controls, the application program detects that the interactive controls are triggered, namely, the application events corresponding to the interactive controls are acquired, and then the event types of the application events are acquired, so that corresponding application functions can be operated based on the event types. Meanwhile, the application page also supports interface interaction such as page sliding, page turning and the like, and accordingly, the application page can be used as an integral 'interaction control', and an application program can acquire application events (page sliding, page turning, closing and the like) corresponding to the application page according to user operation input by a user aiming at the application page, and further acquire corresponding event types.
In an alternative embodiment, for the processing of the application event, the processing may be implemented by a hybrid between Native and Flutter, specifically, the application event is a Flutter event, and in response to the Flutter event in Native, communication between the Native layer and the Flutter layer may be implemented by a communication mechanism provided by the Flutter, that is, full duplex communication of the Flutter. The application page is used for processing application events based on a Fluter layer and a Native layer, the Fluter layer is responsible for monitoring the events, when the user operation triggers the application events, the Fluter layer transmits the monitored application events to the Native layer, the Native layer processes the application events, and the method comprises the steps of determining event types of the application events, returning application parameters required by application functions for running the application events to the Fluter layer and the like. Wherein, the router layer and Native layer form an event handler that processes application events.
For the determining process of the event type, when the user operation triggers the application event, the application program can respond to the user operation aiming at the application page in the application program through the Flutter layer, capture the application event triggered by the user operation through the Flutter layer of the application page, transmit the application event to the Native layer of the application page, and then acquire the target event type of the application event through the Native layer. For the capturing process of the application event, reference may be made to the foregoing embodiments, and details thereof are not repeated herein.
102, acquiring each model object in the application program, wherein each model object is configured with an entry protocol;
for an application program, in order to simplify the data structure, a developer can optimize the data structure of a service class, package the service class into a corresponding model object, on one hand, can combine parameter optimization related to the service class into a plurality of fixed parameters, reduce redundant parameters, and on the other hand, based on a uniform data structure, the application program is convenient to develop and maintain by the developer.
In addition, for different model objects, a unified form can be adopted to configure a corresponding entry protocol for each model object, and the selection of the model object can be realized under the condition of triggering an application event through the entry protocol, so that a service class instance can be directly determined by selecting the model object through a matching result between the entry protocol and the event type, the reference relation between the event type and the service class is not required to be configured in the application program, the data structure of the application program is optimized, and the memory size of the application program is reduced.
In the development or maintenance process of the application program, a plurality of standard application parameters corresponding to the service class can be obtained by obtaining the service class corresponding to the application function and a plurality of original application parameters of the service class, combining the original application parameters of the same parameter type into a standard application parameter aiming at each service class, the number of the standard application parameters is smaller than that of the original parameters, then a plurality of standard application parameters belonging to the same service class are used as object attributes, and a model object corresponding to the service class is created based on the object attributes, so that a data structure is simplified, data redundancy is reduced, and meanwhile, the standard application parameters are used as object attributes to construct the model object, so that the problem of parameter confusion is solved.
For the business class, the application parameters included in the business class can include page type, event content, event supplement parameters, view controller, callback result, event type and the like.
The page type characterizes the corresponding entries of the application pages with different display forms, such as the application page with half-screen display and the application page with full-screen display, and the relation between the application event and the application page can be determined through the parameters, including the display of the application event on the half-screen page or the full-screen page, and the like.
The event content includes content corresponding to an application event, for example, the application event is a page skip, and the event content may include a skip link address corresponding to the page skip.
Event replenishment parameters characterize replenishment parameters of event content, e.g., page jumps for application events, which may further contain user cookies (local data of the user) etc.
The view controller characterizes which controller the view is on, is used for identifying the layer level corresponding to the application event, and in the application program, different layer levels can be divided into the application pages, for example, a popup window is displayed on a conventional application page, and then the popup window and the conventional application page belong to different layer levels, and correspond to different view controllers.
The callback result represents a callback after the function method is executed, and when a certain application event is executed, the callback result can be used for feeding back corresponding execution results, such as execution success, execution failure and the like.
The event type is information for identifying application events, and different application events correspond to different event types.
It should be noted that, for the service class, at least including the above application parameters but not limited to the listed application parameters, in the above example, only basic parameters necessary for executing the application event are listed, and different service classes may also correspond to other specific parameters, which are not listed here, because more application parameters are included, in this embodiment of the present invention, a plurality of standard application parameters may be preset, and the number of standard application parameters may be limited, when creating the model object, the original application parameters belonging to the same parameter type are combined into one standard application parameter, and finally, each model object includes the same number of standard application parameters, so as to implement combination of application parameters and optimize the data structure.
In one example, assume that the original application parameters of the business class in the application program include parameter a, parameter b, parameter c, parameter d, parameter e, parameter f, parameter g, and parameter h. Setting 6 standard application parameters, namely 6 parameter types including page type, event content, event supplement parameter, view controller, callback result, event type and the like, combining the original application parameters of the service type according to the parameter types, and realizing that the original application parameters of the same parameter type are combined into one standard application parameter, for example, parameter a and parameter B belong to the page type, parameter C belongs to the event content, parameter D belongs to the event supplement parameter, parameter E and F belong to the view controller, parameter g belongs to the callback result, parameter h belongs to the event type, and after the original application parameters of the same parameter type are combined, obtaining parameter A, parameter B, parameter C, parameter D, parameter E and parameter F, and reducing redundant parameters compared with the original application parameters. And taking the parameters A, B, C, D, E and F as object attributes, constructing model objects corresponding to the service classes, wherein each model object contains application parameters of the same parameter type, and the problem of parameter confusion is solved based on the model objects with uniform data structures.
In addition, after the model object corresponding to each service class is constructed, a unified type of entry protocol can be configured for different model objects, specifically, the entry protocol can be used as the object attribute of the model object, and the model object can be formed together with each standard application parameter. The portal protocol can comprise an event type returning method and an object calling method, the former is used for determining the event type returned by the portal protocol, the latter can call standard application parameters of a model object, the portal protocol is formed into a portal protocol through a fixed number and an acting function method, the portal protocol is used as a call portal of the model object, the model object is called through the call portal in a unified form, the unification of the call portal is realized, and in the development and maintenance of an application program, a developer develops and maintains the portal protocol, namely the development and maintenance of the call mode of the model object can be realized.
For different model objects, the event type returned by the event type return method in the entry protocol is associated with the model object, and correspondingly, the application parameters called by the object calling method are also associated with the model object, i.e. different model objects correspond to the entry protocol in a unified form, but the event type return method of the entry protocol and the processing results of the function methods such as the object calling method can be different. In addition, the event type return method and the object calling method may be function methods, which the present invention is not limited to.
For example, for a check-in event, it may correspond to a model object (1), where the model object (1) corresponds to an entry protocol i, and an event type returned by an event type return method of the entry protocol i is a "check-in event", and accordingly, standard application parameters in the model object (1) may be invoked by an object invoking method; for the page jump event, it may correspond to the model object (2), where the model object (2) corresponds to the entry protocol ii, and the event type returned by the event type return method of the entry protocol ii is the "page taoozhuan event", and accordingly, the standard application parameters in the model object (2) may be invoked by the object invoking method, which is not limited in this aspect of the invention.
In an example, referring to fig. 2, a schematic structural diagram of a Model object provided in an embodiment of the present invention is shown, where a Model object (Model) corresponds to a service class, and may include corresponding application parameters (such as a parameter a, a parameter b, a parameter c, a parameter d …, etc.), and the parameter types are a page type, an event content, an event supplement parameter, a view controller, a callback result, and an event type. Meanwhile, the model object can be configured with a corresponding entry protocol to unify the calling mode of the service class, and in the development and maintenance process of the application program, because the model object contains ordered parameters, a developer can conveniently develop and maintain the application program, and the pressure of developing and maintaining the application program is reduced, so that on one hand, the problem of parameter confusion is solved based on the model object with a unified data structure, on the other hand, the model object is called through the calling entry in the unified mode, the unification of the calling entry is realized, and in the development and maintenance process of the application program, the developer develops and maintains the entry protocol, and the calling mode of the model object can be developed and maintained.
Step 103, matching the entry protocol with the target event type, and selecting a target model object corresponding to the target event type from the model objects according to a matching result;
for an application program, when a user operation triggers a corresponding application event, the event processor may match the target event type with an entry protocol corresponding to each model object after determining the corresponding target event type, so as to select a target model object corresponding to the target event type from all model objects.
In a specific implementation, the event processor may first call the event type return method in each entry protocol to execute a corresponding code or code block to obtain a first event type corresponding to each model object, then match the target event type with each first event type, characterize the first event type with the target event type as the same event type as a second event type, regard the entry protocol to which the second event type belongs as the target entry protocol, and then use the model object to which the target entry protocol belongs as the target model object corresponding to the target event type.
In an alternative embodiment, for a mixed scenario of Native and Flutter, an application program may execute an event type return method in each entry protocol through a Native layer to obtain a first event type corresponding to each model object, then characterize, through the Native layer, the first event type that is the same as a target event type as a second event type, and use, as a target entry protocol, an entry protocol to which the second event type belongs, and then use, through the Native layer, a model object to which the target entry protocol belongs as a target model object corresponding to the target event type, so that the application program further obtains application parameters corresponding to the target model object to run a corresponding application function.
In one example, assuming that the application program includes a model object (1), a model object (2), a model object (3), a model object (4), and the like, when the user operation triggers an application event, the Flutter layer may transmit the application event to the Native layer, and then the Native layer, while determining a target event type corresponding to the application event, invokes an event type return method in an entry protocol of each model object to return an event type corresponding to each model object, including an event type 1 corresponding to the model object (1), an event type 2 corresponding to the model object (2), an event type 3 corresponding to the model object (3), and an event type 4 corresponding to the model object (4), where the event type 2 is the same event type as the target event type, may use the model object (2) as the target model object, so as to further respond to the user operation according to the application function corresponding to the target model object operation.
And 104, running an application function corresponding to the target model object to respond to the user operation.
In a specific implementation, based on the description in the foregoing embodiment, the target model object may include an application parameter required for running an application function, so that an event processor of the application program may acquire the target application parameter in the target model object through an object calling method, and then run the application function corresponding to the target application parameter in the application program, so that in a process of needing to run the application function corresponding to the user operation, the model object is selected through a matching result between the entry protocol and the event type, and a reference relation related to a service class does not need to be configured in the application program, thereby optimizing a data structure of the application program and reducing a memory size of the application program.
In an alternative embodiment, when a target model object is determined in a mixed scene of Native and Flutter, an application program can execute an object calling method of a target entry protocol through a Native layer to obtain target application parameters of the target model object, the target application parameters are transferred to the Flutter layer, and then an application function corresponding to the target model object is operated according to the target application parameters through the Flutter layer to respond to user operation, so that in the mixed scene of Native and Flutter, the model object is selected through a matching result between the entry protocol and an event type, a reference relation related to a service class does not need to be configured in the application program, the data structure of the application program is optimized, the memory size of the application program is reduced, and for an application developer, after the data structure of the application program is optimized through the model object and the entry protocol, a control flow structure such as a switch-case structure is not required to be added in the application program, the readability of a bottom layer code is improved, the application developer only needs to be subjected to the model object and the maintenance of the application program, and the grammar and the development and maintenance cost is reduced, and the maintenance and the development and maintenance costs are reduced.
In one example, assuming that the model object includes a model object (1) corresponding to a check-in event and a model object (2) corresponding to a page jump event, which correspond to an entry protocol i and an entry protocol ii respectively, when a user inputs a page jump operation in an application program, a Flutter layer in an event processor monitors the page jump event, transmits the page jump event to a Native layer in the event processor, the Native layer acquires an event type corresponding to the page jump event, namely, a "page jump", then the Native layer can detect whether the event type returned by each entry protocol is the "page jump", wherein the event type returned by an event type return method of the entry protocol ii is the "page jump", then the Native layer can further call application parameters of the model object b through an object call method in the entry protocol ii, then read the application parameters (page type, event content, event supplement parameters, a view controller, callback results and event types) in the model object b, transmit the application parameters to the Native layer, and execute corresponding application functions based on the parameters by the Native layer.
Referring to fig. 3, a flow chart of event triggering provided in an embodiment of the present invention is shown, after a corresponding event is triggered, an event processor may match a corresponding target model object through a unified entry protocol after determining the event type, and then call application parameters related to the target model object to run a corresponding application function.
In the embodiment of the invention, for an application program, a target event type corresponding to user operation can be obtained in response to the user operation aiming at the application program, meanwhile, each model object in the application program can be obtained, each model object is configured with an entry protocol, each model object is associated with an application function of the application program, then the entry protocol of each model object can be matched with the target event type, the target model object corresponding to the target event type is selected from each model object according to a matching result, then the application function corresponding to the target model object is operated to respond to the user operation, thus, in the process of needing to operate the application function corresponding to the user operation, the model object is selected through the matching result between the entry protocol and the event type, the reference relation related to a service class is not required to be configured in the application program, the data structure of the application program is optimized, the memory size of the application program is reduced, and for an application developer, only the model object, the entry protocol and the like are required to be maintained, the difficulty of application development and maintenance is reduced, and the development and maintenance cost is reduced.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 4, a block diagram of an embodiment of an apparatus for processing an application event according to the present invention may specifically include the following modules:
an event type obtaining module 401, configured to obtain a target event type corresponding to a user operation in response to the user operation for the application program;
an object obtaining module 402, configured to obtain model objects in the application program, where each model object is configured with an entry protocol;
an object matching module 403, configured to match the entry protocol with the target event type, and select, according to a matching result, a target model object corresponding to the target event type from the model objects;
And a function running module 404, configured to run an application function corresponding to the target model object in response to the user operation.
In an alternative embodiment, the event type obtaining module 401 is specifically configured to:
responding to user operation aiming at an application page in an application program, capturing an application event triggered by the user operation through a Fluter layer of the application page, and transmitting the application event to a Native layer of the application page;
and acquiring the target event type of the application event through the Native layer.
In an alternative embodiment, the object matching module 403 is specifically configured to:
acquiring a first event type returned by an entry protocol of each model object through the Native layer;
characterizing a first event type which is the same as the target event type as a second event type through the Native layer, and taking an entry protocol to which the second event type belongs as a target entry protocol;
and taking the model object to which the target entry protocol belongs as a target model object corresponding to the target event type through the Native layer.
In an alternative embodiment, the entry protocol includes an event type return method, and the object matching module 403 is specifically configured to:
And executing an event type returning method in each entry protocol through the Native layer to obtain a first event type corresponding to each model object.
In an alternative embodiment, the entry protocol includes an object calling method, and the function execution module 404 is specifically configured to:
executing an object calling method of the target entry protocol through the Native layer to obtain target application parameters of the target model object, and transmitting the target application parameters to the router layer;
and running an application function corresponding to the target model object according to the target application parameter through the router layer so as to respond to the user operation.
In an alternative embodiment, the model object is generated by the following modules:
the service class acquisition module is used for acquiring a service class corresponding to an application function and a plurality of original application parameters of the service class;
the parameter combination module is used for combining original application parameters with the same parameter type into standard application parameters to obtain a plurality of standard application parameters corresponding to the service class, wherein the number of the standard application parameters is smaller than that of the original parameters;
And the object creation module is used for taking each standard application parameter as an object attribute and creating a model object corresponding to the service class based on the object attribute.
In an alternative embodiment, the standard application parameters include at least page type, event content, event replenishment parameters, view controller, callback results, and event type; each of the model objects corresponds to a business class.
For the above-described device embodiments, the description is relatively simple, as it is substantially similar to the method embodiments, with reference to the description of the method embodiments in part.
In addition, the embodiment of the invention also provides an electronic device, which comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program realizes the processes of the processing method embodiment of the application event when being executed by the processor, and can achieve the same technical effects, and the repetition is avoided, so that the description is omitted.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements each process of the above embodiment of the processing method of application events, and can achieve the same technical effects, so that repetition is avoided, and no further description is given here. Wherein the computer readable storage medium is selected from Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
As will be readily appreciated by those skilled in the art: any combination of the above embodiments is possible, and thus is an embodiment of the present invention, but the present specification is not limited by the text.
The methods of processing application events provided herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a system constructed with aspects of the present invention will be apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
Various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functions of some or all of the components in the method of processing application events according to embodiments of the present invention may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). The present invention can also be implemented as an apparatus or device program (e.g., a computer program and a computer program product) for performing a portion or all of the methods described herein. Such a program embodying the present invention may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.

Claims (10)

1. A method for processing an application event, comprising:
responding to user operation aiming at an application program, and acquiring a target event type corresponding to the user operation;
acquiring each model object in the application program, wherein each model object is configured with an entry protocol;
Matching the entry protocol with the target event type, and selecting a target model object corresponding to the target event type from the model objects according to a matching result;
and running an application function corresponding to the target model object to respond to the user operation.
2. The method according to claim 1, wherein the obtaining, in response to the user operation for the application program, the target event type corresponding to the user operation includes:
responding to user operation aiming at an application page in an application program, capturing an application event triggered by the user operation through a Fluter layer of the application page, and transmitting the application event to a Native layer of the application page;
and acquiring the target event type of the application event through the Native layer.
3. The method according to claim 2, wherein said matching the entry protocol with the target event type, selecting a target model object corresponding to the target event type from the respective model objects according to a matching result, comprises:
acquiring a first event type returned by an entry protocol of each model object through the Native layer;
Characterizing a first event type which is the same as the target event type as a second event type through the Native layer, and taking an entry protocol to which the second event type belongs as a target entry protocol;
and taking the model object to which the target entry protocol belongs as a target model object corresponding to the target event type through the Native layer.
4. A method according to claim 3, wherein the entry protocol includes an event type return method, and the acquiring, by the Native layer, a first event type returned by the entry protocol of each of the model objects includes:
and executing an event type returning method in each entry protocol through the Native layer to obtain a first event type corresponding to each model object.
5. The method of claim 2, 3 or 4, wherein the portal protocol includes an object invocation method, the running an application function corresponding to the target model object in response to the user operation, comprising:
executing an object calling method of the target entry protocol through the Native layer to obtain target application parameters of the target model object, and transmitting the target application parameters to the router layer;
And running an application function corresponding to the target model object according to the target application parameter through the router layer so as to respond to the user operation.
6. The method of claim 1, wherein the model object is generated by:
acquiring a service class corresponding to an application function and a plurality of original application parameters of the service class;
combining original application parameters of the same parameter type to obtain a plurality of standard application parameters corresponding to the service class, wherein the number of the standard application parameters is smaller than that of the original parameters;
and taking each standard application parameter as an object attribute, and creating a model object corresponding to the service class based on the object attribute.
7. The method of claim 6, wherein the standard application parameters include at least page type, event content, event replenishment parameters, view controller, callback results, and event type; each of the model objects corresponds to a business class.
8. An apparatus for processing an application event, comprising:
the event type acquisition module is used for responding to the user operation aiming at the application program and acquiring a target event type corresponding to the user operation;
The object acquisition module is used for acquiring each model object in the application program, and each model object is configured with an entry protocol;
the object matching module is used for matching the entry protocol with the target event type, and selecting a target model object corresponding to the target event type from the model objects according to a matching result;
and the function running module is used for running the application function corresponding to the target model object to respond to the user operation.
9. An electronic device, comprising:
one or more processors; and
one or more machine readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform the method of processing application events of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements a method of processing an application event according to any of claims 1 to 7.
CN202310792794.9A 2023-06-29 2023-06-29 Application event processing method and device, electronic equipment and storage medium Pending CN116795568A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310792794.9A CN116795568A (en) 2023-06-29 2023-06-29 Application event processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310792794.9A CN116795568A (en) 2023-06-29 2023-06-29 Application event processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116795568A true CN116795568A (en) 2023-09-22

Family

ID=88041606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310792794.9A Pending CN116795568A (en) 2023-06-29 2023-06-29 Application event processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116795568A (en)

Similar Documents

Publication Publication Date Title
JP6580664B2 (en) Cloud-connected automated testing
US7908580B2 (en) Connecting an integrated development environment with an application instance
US8751558B2 (en) Mashup infrastructure with learning mechanism
US20160004628A1 (en) Parallel test execution framework for multiple web browser testing
CN106133698A (en) Framework for user model collapse report
US20150020057A1 (en) Controlling application features
US20080059940A1 (en) System and method for implementing a safe framework
US8924867B2 (en) Web interface for remote platform build
US20150331784A1 (en) System and method for controlling test script execution by smartphone
CN113704110B (en) Automatic testing method and device for user interface
US20220214872A1 (en) Dynamic review of software updates after pull requests
CN114297056A (en) Automatic testing method and system
CN113760763A (en) Software testing method, device, server and system
US20080059949A1 (en) System and method for implementing a safe framework
CN110764746B (en) Script generation method and device and computer readable storage medium
CN110717992B (en) Method, apparatus, computer system and readable storage medium for scheduling model
EP3627313A1 (en) Method and system for operating a software application on a processor of a mobile device
CN116795568A (en) Application event processing method and device, electronic equipment and storage medium
CN115840617A (en) Debugging method, system and related device
KR101418390B1 (en) system for remotely debugging an application programming and controlling method therefor
US10061686B2 (en) Method, electronic apparatus, system, and storage medium for automated testing of application user interface
CN111324332A (en) Big data task processing method and system, electronic device and storage medium
US11740995B2 (en) Source quality check service
CN112231231B (en) Cloud service debugging method, system and device
JP2015148925A (en) Program generation device and method

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