Intelligent extension method, device and system for WebView component
Through the intelligent extension method of WebView component, including initialization, event monitoring and logging, the problem of low expansion efficiency of WebView component is solved, efficient and accurate function expansion and event processing are achieved, and the user experience is optimized.
Patent Information
- Application Number
- CN202510483456.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-09-12
AI Technical Summary
In the existing technology, the expansion method of the WebView component relies on manual coding and fixed expansion modes, resulting in low expansion efficiency and accuracy. As the complexity of the component increases, the difficulty and workload of the expansion work increase exponentially.
This paper provides an intelligent extension method for WebView components, including initialization operations, event monitoring, function extension and logging. Through event execution logic and function information judgment, it realizes intelligent extension of components and supports two-way communication and flexible configuration.
It improves the functional expansion efficiency and accuracy of the WebView component, improves the event processing efficiency and accuracy, reduces the difficulty of maintenance and management, and optimizes the implementation effects and user experience of different business scenarios.
Smart Images

Figure CN120631456A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to an intelligent expansion method, device and system for a WebView component. Background Art
[0002] With the development of science and technology, the field of software development is undergoing unprecedented changes. Among them, component-based design is one of the important means to improve software development efficiency and quality.
[0003] Currently, the component extension method is mainly for developers when they need to expand component functions, especially in the HarmonyOS NEXT system (this system is the latest operating system launched by Huawei, whose core features include multi-device interconnection capabilities, deep integration of AI and operating systems, and privacy protection functions. This system aims to create a full-scene intelligent operating system in the era of intelligent connection of all things, and has also made significant progress in ecological construction). It often relies on manual coding and fixed extension modes. Developers need to have an in-depth understanding of the internal implementation of the component in advance, and add new functions or modify existing functions by writing a lot of code, which takes a lot of time and effort. Moreover, as the complexity of the component increases, the difficulty and workload of the component extension work will increase exponentially, making the component expansion efficiency and expansion accuracy low. It can be seen that it is particularly important to provide a new component expansion method to improve the expansion efficiency and expansion accuracy of the component. Summary of the Invention
[0004] The present invention provides an intelligent expansion method, device and system for the WebView component, which can improve the function expansion efficiency and function expansion accuracy of the WebView component, and further improve the event processing efficiency and event processing accuracy based on the WebView component.
[0005] To solve the above technical problems, the first aspect of the present invention discloses an intelligent expansion method for a WebView component. The method is applied to an electronic device equipped with a HarmonyOS NEXT system, wherein the electronic device has an application installed therein and is communicatively connected to a network attached storage device. The electronic device can access the network attached storage device through the application. The method comprises:
[0006] Perform corresponding initialization operations on the target component to obtain the component initialization result;
[0007] Based on the component initialization result, execute the corresponding event monitoring operation to obtain the event to be processed;
[0008] Determine an event execution logic according to the event to be processed, determine the conventional component function information of the target component and the required function information corresponding to the event to be processed, and perform corresponding basic processing and / or function extension processing operations on the event to be processed according to the event execution logic, the conventional component function information and the required function information to obtain an event processing result;
[0009] Based on the event processing result, a corresponding log recording operation is performed to obtain a log recording result, and the log recording result is used for system operation status monitoring and / or system development.
[0010] As an optional implementation, in the first aspect of the present invention, performing a corresponding initialization operation on the target component to obtain a component initialization result includes:
[0011] Determine the initial parameter information corresponding to the target component according to the preset configuration file, and perform corresponding attribute configuration operations on the pre-created default configuration object for the target component according to the initial parameter information;
[0012] Based on the target component, a corresponding component controller creation operation is performed to obtain a basic component controller, and a corresponding initial state setting operation is performed on the basic component controller to obtain a target component controller corresponding to the target component;
[0013] Based on the target component, the corresponding interface object creation operation is performed to obtain the basic interface object, and the corresponding interface object registration operation is performed on the basic interface object and the target component to obtain the interface object registration result to realize the two-way communication function corresponding to the target component.
[0014] As an optional implementation manner, in the first aspect of the present invention, determining the event execution logic according to the event to be processed includes:
[0015] Determine a corresponding event processing framework according to the event to be processed, and determine a corresponding event execution logic according to the event to be processed and the event processing framework, wherein the event execution logic includes a default type logic or a custom type logic;
[0016] Furthermore, performing corresponding basic processing and / or function extension processing operations on the event to be processed according to the event execution logic, the conventional component function information, and the required function information to obtain an event processing result includes:
[0017] Determining whether the event to be processed meets a preset function extension calling condition based on the conventional component function information and the required function information;
[0018] When it is determined that the event to be processed does not meet the function extension calling condition, performing a corresponding basic event processing operation on the event to be processed according to the event execution logic to obtain an event processing result;
[0019] When it is determined that the event to be processed meets the function extension call condition, the corresponding basic and function extension event processing operations are performed on the event to be processed according to the conventional component function information, the required function information and the event execution logic to obtain an event processing result.
[0020] As an optional implementation, in the first aspect of the present invention, performing corresponding basic and function-extended event processing operations on the event to be processed based on the conventional component function information, the required function information, and the event execution logic to obtain an event processing result includes:
[0021] Determine the target specific demand function corresponding to the event to be processed according to the conventional component function information and the demand function information, and determine the target extension module corresponding to the target specific demand function;
[0022] Based on the event execution logic, a corresponding basic event processing operation is performed on the event to be processed, and based on the target extension module and the target specific requirement function, a corresponding function extension event processing operation is performed on the event to be processed to obtain an event processing result.
[0023] As an optional implementation manner, in the first aspect of the present invention, determining the corresponding event execution logic according to the event to be processed and the event processing framework includes:
[0024] Determine whether the event to be processed meets the preset conventional logic requirement conditions;
[0025] When it is determined that the event to be processed meets the conventional logic requirement, a target default type logic is determined according to the event to be processed, the event processing framework and the preset default type logic set as the corresponding event execution logic;
[0026] When it is determined that the event to be processed does not meet the conventional logic requirement condition, it is determined whether the event to be processed meets the preset historical custom logic condition;
[0027] When it is determined that the event to be processed meets the historical custom logic condition, a first target custom type logic is determined as the corresponding event execution logic according to the event to be processed, the event processing framework, and a preset historical custom type logic set;
[0028] When it is determined that the event to be processed does not meet the pre-defined logical conditions, a second target custom type logic is determined as the corresponding event execution logic based on the collected user's custom operation of matching the event to be processed and the event processing framework.
[0029] As an optional implementation, in the first aspect of the present invention, judging whether the to-be-processed event meets a preset function extension calling condition based on the conventional component function information and the required function information includes:
[0030] Determining a first processing function based on the conventional component function information, and determining a second processing function based on the required function information;
[0031] determining whether the first processing function matches the second processing function;
[0032] When it is determined that the first processing function matches the second processing function, determining that the event to be processed does not meet a preset function extension calling condition;
[0033] When it is determined that the first processing function does not match the second processing function, it is determined that the event to be processed meets a preset function extension calling condition.
[0034] As an optional implementation manner, in the first aspect of the present invention, performing a corresponding logging operation based on the event processing result to obtain a logging result includes:
[0035] Determining first regular event operation information that needs to be logged and output according to the event processing result and the event to be processed;
[0036] Determine, based on the event processing result, each type of information corresponding to the event itself and the processing operation of the event to be processed and its criticality, and determine, based on the criticality of each type of information, second critical event operation information that needs to be logged and output;
[0037] Corresponding log recording operations are performed on the first regular event operation information and the second key event operation information to obtain log recording results.
[0038] A second aspect of the present invention discloses an intelligent expansion device for a WebView component, the device comprising an electronic device equipped with a HarmonyOS NEXT system, an application installed in the electronic device, the electronic device being communicatively connected to a network attached storage device, and the electronic device being able to access the network attached storage device through the application, the device comprising:
[0039] The initialization module is used to perform corresponding initialization operations on the target component and obtain the component initialization result;
[0040] An event monitoring module is used to perform corresponding event monitoring operations based on the component initialization result to obtain the event to be processed;
[0041] An event processing module is used to determine an event execution logic based on the event to be processed, and determine the conventional component function information of the target component and the required function information corresponding to the event to be processed, and perform corresponding basic processing and / or function extension processing operations on the event to be processed based on the event execution logic, the conventional component function information and the required function information to obtain an event processing result;
[0042] The log recording module is used to perform corresponding log recording operations based on the event processing results to obtain log recording results, and the log recording results are used for system operation status monitoring and / or system development.
[0043] As an optional implementation, in the second aspect of the present invention, the initialization module performs corresponding initialization operations on the target component, and the manner in which the component initialization result is obtained specifically includes:
[0044] Determine the initial parameter information corresponding to the target component according to the preset configuration file, and perform corresponding attribute configuration operations on the pre-created default configuration object for the target component according to the initial parameter information;
[0045] Based on the target component, a corresponding component controller creation operation is performed to obtain a basic component controller, and a corresponding initial state setting operation is performed on the basic component controller to obtain a target component controller corresponding to the target component;
[0046] Based on the target component, the corresponding interface object creation operation is performed to obtain the basic interface object, and the corresponding interface object registration operation is performed on the basic interface object and the target component to obtain the interface object registration result to realize the two-way communication function corresponding to the target component.
[0047] As an optional implementation, in the second aspect of the present invention, the manner in which the event processing module determines the event execution logic according to the event to be processed specifically includes:
[0048] Determine a corresponding event processing framework according to the event to be processed, and determine a corresponding event execution logic according to the event to be processed and the event processing framework, wherein the event execution logic includes a default type logic or a custom type logic;
[0049] Furthermore, the event processing module performs corresponding basic processing and / or function extension processing operations on the event to be processed according to the event execution logic, the conventional component function information and the required function information, and the manner in which the event processing result is obtained specifically includes:
[0050] Determining whether the event to be processed meets a preset function extension calling condition based on the conventional component function information and the required function information;
[0051] When it is determined that the event to be processed does not meet the function extension calling condition, performing a corresponding basic event processing operation on the event to be processed according to the event execution logic to obtain an event processing result;
[0052] When it is determined that the event to be processed meets the function extension call condition, the corresponding basic and function extension event processing operations are performed on the event to be processed according to the conventional component function information, the required function information and the event execution logic to obtain an event processing result.
[0053] As an optional implementation, in the second aspect of the present invention, the event processing module performs corresponding basic and function-extended event processing operations on the event to be processed based on the conventional component function information, the required function information, and the event execution logic, and the manner in which the event processing result is obtained specifically includes:
[0054] Determine the target specific demand function corresponding to the event to be processed according to the conventional component function information and the demand function information, and determine the target extension module corresponding to the target specific demand function;
[0055] Based on the event execution logic, a corresponding basic event processing operation is performed on the event to be processed, and based on the target extension module and the target specific requirement function, a corresponding function extension event processing operation is performed on the event to be processed to obtain an event processing result.
[0056] As an optional implementation, in the second aspect of the present invention, the event processing module determines the corresponding event execution logic according to the event to be processed and the event processing framework, specifically including:
[0057] Determine whether the event to be processed meets the preset conventional logic requirement conditions;
[0058] When it is determined that the event to be processed meets the conventional logic requirement, a target default type logic is determined according to the event to be processed, the event processing framework and the preset default type logic set as the corresponding event execution logic;
[0059] When it is determined that the event to be processed does not meet the conventional logic requirement condition, it is determined whether the event to be processed meets the preset historical custom logic condition;
[0060] When it is determined that the event to be processed meets the historical custom logic condition, a first target custom type logic is determined as the corresponding event execution logic according to the event to be processed, the event processing framework, and a preset historical custom type logic set;
[0061] When it is determined that the event to be processed does not meet the pre-defined logical conditions, a second target custom type logic is determined as the corresponding event execution logic based on the collected user's custom operation of matching the event to be processed and the event processing framework.
[0062] As an optional implementation, in the second aspect of the present invention, the event processing module determines whether the event to be processed meets the preset function extension calling condition based on the conventional component function information and the required function information, specifically including:
[0063] Determining a first processing function based on the conventional component function information, and determining a second processing function based on the required function information;
[0064] determining whether the first processing function matches the second processing function;
[0065] When it is determined that the first processing function matches the second processing function, determining that the event to be processed does not meet a preset function extension calling condition;
[0066] When it is determined that the first processing function does not match the second processing function, it is determined that the event to be processed meets a preset function extension calling condition.
[0067] As an optional implementation, in the second aspect of the present invention, the logging module performs corresponding logging operations based on the event processing result, and the manner of obtaining the logging result specifically includes:
[0068] Determining first regular event operation information that needs to be logged and output according to the event processing result and the event to be processed;
[0069] Determine, based on the event processing result, each type of information corresponding to the event itself and the processing operation of the event to be processed and its criticality, and determine, based on the criticality of each type of information, second critical event operation information that needs to be logged and output;
[0070] Corresponding log recording operations are performed on the first regular event operation information and the second key event operation information to obtain log recording results.
[0071] A third aspect of the present invention discloses an electronic device, comprising:
[0072] a memory storing executable program code;
[0073] a processor coupled to the memory;
[0074] The processor calls the executable program code stored in the memory to execute the intelligent expansion method for the WebView component disclosed in the first aspect of the present invention.
[0075] A fourth aspect of the present invention discloses a computer storage medium storing computer instructions. When the computer instructions are called, they are used to execute the intelligent expansion method for the WebView component disclosed in the first aspect of the present invention.
[0076] A fifth aspect of the present invention discloses an intelligent expansion system for a WebView component, the system comprising the intelligent expansion device for a WebView component disclosed in the second aspect of the present invention, and a network attached storage device communicatively connected to the device; or
[0077] The system includes the electronic device disclosed in the third aspect of the present invention, and a network attached storage device communicatively connected to the electronic device.
[0078] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0079] In an embodiment of the present invention, a corresponding initialization operation is performed on a target component to obtain a component initialization result; based on the component initialization result, a corresponding event monitoring operation is performed to obtain an event to be processed; an event execution logic is determined according to the event to be processed, and the conventional component function information of the target component and the required function information corresponding to the event to be processed are determined, and based on the event execution logic, the conventional component function information and the required function information, corresponding basic processing and / or function extension processing operations are performed on the event to be processed to obtain an event processing result; based on the event processing result, a corresponding log recording operation is performed to obtain a log recording result, which is used for system operation status monitoring and / or system development. It can be seen that the present invention can realize the intelligent expansion function of the component through initialization operations, event monitoring operations, function expansion and event processing operations, log recording operations, etc., which is conducive to improving the comprehensiveness, integrity and rationality of the intelligent expansion method of the component, and thus is conducive to improving the functional extensibility of the component, and is conducive to improving the functional expansion flexibility, convenience, efficiency of the component, and is conducive to improving the functional expansion accuracy and reliability of the component, thereby helping to improve event processing efficiency and event processing accuracy, improve development efficiency and development convenience, reduce the difficulty of component maintenance and management, improve the accuracy and efficiency of maintenance management, and further help to optimize the implementation effect and user experience for different business scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0081] Figure 1 This is a flow chart of an intelligent expansion method for a WebView component disclosed in an embodiment of the present invention;
[0082] Figure 2 This is a flowchart of another intelligent expansion method for a WebView component disclosed in an embodiment of the present invention;
[0083] Figure 3 This is a schematic diagram of the structure of an intelligent expansion device for a WebView component disclosed in an embodiment of the present invention;
[0084] Figure 4 This is a schematic structural diagram of an electronic device disclosed in an embodiment of the present invention;
[0085] Figure 5This is a schematic diagram of the architecture of an intelligent extension system for a WebView component disclosed in an embodiment of the present invention;
[0086] Figure 6 This is a flow chart of another intelligent expansion method for the WebView component disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0087] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0088] The terms "first," "second," and so on, in the description and claims of the present invention and the accompanying drawings are used to distinguish between different items, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or end comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed therein, or may optionally include other steps or elements inherent to such process, method, product, or end.
[0089] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0090] The present invention discloses an intelligent expansion method, device, and system for a WebView component, which can realize the intelligent expansion function of the component through initialization operations, event monitoring operations, function expansion and event processing operations, log recording operations, etc., which is conducive to improving the comprehensiveness, integrity, and rationality of the intelligent expansion method for the component, thereby improving the functional extensibility of the component, and improving the flexibility, convenience, and efficiency of the functional expansion of the component, as well as improving the accuracy and reliability of the functional expansion of the component, thereby improving the efficiency and accuracy of event processing, improving development efficiency and convenience, reducing the difficulty of component maintenance and management, and improving the accuracy and efficiency of maintenance and management, further facilitating the optimization of the implementation effect and user experience for different business scenarios. Detailed descriptions are given below.
[0091] Example 1
[0092] See also Figure 1 , Figure 1 This is a flow chart of an intelligent expansion method for a WebView component disclosed in an embodiment of the present invention. Figure 1 The method described can be applied to an electronic device equipped with a HarmonyOS NEXT system, in which an application is installed, and the electronic device is in communication connection with a network attached storage device, and the electronic device can access the network attached storage device through the application, which is not limited in the embodiment of the present invention. Figure 1 As shown, the intelligent extension method for the WebView component includes the following operations:
[0093] 101. Perform corresponding initialization operations on the target component to obtain a component initialization result.
[0094] Optional, such as Figure 6 As shown, the initialization operation may include but is not limited to loading a configuration file, initializing a WebView controller, registering a JavaScript interface, etc., which is not limited in the embodiment of the present invention.
[0095] Optionally, the target component may be a WebView component, which is not limited in this embodiment of the present invention.
[0096] 102. Based on the component initialization result, execute the corresponding event monitoring operation to obtain the event to be processed.
[0097] Optionally, various events of WebView (such as page loading, error, click, etc.) are monitored by WebviewController (i.e., the component controller corresponding to the target component) to obtain events to be processed, which is not limited in this embodiment of the present invention.
[0098] 103. Determine the event execution logic based on the event to be processed, and determine the general component function information of the target component and the required function information corresponding to the event to be processed, and perform corresponding basic processing and / or function extension processing operations on the event to be processed based on the event execution logic, general component function information and required function information to obtain the event processing result.
[0099] Optional, such as Figure 6 As shown, basic processing and / or functional extension processing operations may include but are not limited to calling an event processing framework, executing developer-defined logic, executing default logic, calling extension modules (such as file selection, permission management, etc.), returning processing results, etc., and are not limited in the embodiments of the present invention.
[0100] 104. Based on the event processing result, perform corresponding log recording operations to obtain log recording results, and the log recording results are used for system operation status monitoring and / or system development.
[0101] Optional, such as Figure 6 As shown, the log recording operation may include but is not limited to recording key events and operations, outputting log information, etc., which is not limited in the embodiment of the present invention.
[0102] Optional, Figure 5 This is a system architecture diagram corresponding to this solution, specifically, including a core module, an extension module and an external interface. Furthermore, the core module may include a WebView controller, an event processing framework, a registration JavaScript interface, etc. The extension module may include a file selection module, a permission management module, a pop-up processing module, a log recording module, etc. The external interface may include a Web page, developer-defined logic, etc., which is not limited in the embodiment of the present invention.
[0103] Optionally, this solution divides the functions of WebView into multiple independent modules (such as a file selection module, a permission management module, a pop-up processing module, etc.), which can be flexibly combined and used according to needs; further, for modules involving sensitive operations or core functions (such as a dynamic JavaScript interface registration mechanism), permission control can be set to limit their use to developers or teams of a specific level; in team collaboration, a code review mechanism can be introduced to ensure the rationality and security of the module combination, which is not limited in the embodiments of the present invention.
[0104] Optionally, this solution provides an extensible interface design, which provides a high degree of scalability through interfaces such as ArkWebClient and ArkJsObject, supporting developers to customize the behavior of WebView according to business needs, such as custom file selection logic, permission request processing, etc.; further, regarding the specific description and implementation method of the extensible interface design: it allows functions to be expanded without modifying the core code, and the functions are split into independent modules for easy development and maintenance, and certain functions can be selectively implemented or replaced as needed; further, the event processing logic of WebView can be customized by implementing the ArkWebClient interface, and the native method of JavaScript call can be customized by implementing the ArkJsObject interface. This is not limited in the embodiments of the present invention.
[0105] Optionally, this solution achieves flexible functional expansion and efficient development of the WebView component in the HarmonyOS system through modular design, a unified event processing framework, and a dynamic JavaScript interface registration mechanism, while providing UgWebView with centralized configuration management to improve code maintainability, which is not limited in the embodiments of the present invention.
[0106] It can be seen that the intelligent extension method for the WebView component described in the embodiment of the present invention can realize the intelligent extension function of the component through initialization operations, event monitoring operations, function extension and event processing operations, log recording operations, etc., which is conducive to improving the comprehensiveness, integrity and rationality of the intelligent extension method for the component, and thus is conducive to improving the functional extensibility of the component, and is conducive to improving the functional extension flexibility, convenience, efficiency of the component, and is conducive to improving the functional extension accuracy and reliability of the component, thereby helping to improve event processing efficiency and event processing accuracy, improve development efficiency and development convenience, reduce the difficulty of component maintenance and management, improve the accuracy and efficiency of maintenance management, and further help to optimize the implementation effect and user experience for different business scenarios.
[0107] In an optional embodiment, performing the corresponding initialization operation on the target component to obtain the component initialization result may include:
[0108] Determine the initial parameter information corresponding to the target component according to the preset configuration file, and perform corresponding attribute configuration operations on the pre-created default configuration object for the target component according to the initial parameter information;
[0109] Based on the target component, perform the corresponding component controller creation operation to obtain the basic component controller, and perform the corresponding initial state setting operation on the basic component controller to obtain the target component corresponding to the target component;
[0110] Based on the target component, the corresponding interface object creation operation is performed to obtain the basic interface object, and the corresponding interface object registration operation is performed on the basic interface object and the target component to obtain the interface object registration result to realize the two-way communication function corresponding to the target component.
[0111] Optionally, the above determines the initial parameter information corresponding to the target component based on a preset configuration file. For example, the initial parameter information of WebView (such as cache mode, JavaScript permissions, etc.) is read from a configuration file (such as a JSON or YAML file). This embodiment of the present invention does not limit this.
[0112] Optionally, the above performs corresponding property configuration operations on the pre-created default configuration object for the target component based on the initial parameter information. For example, the configuration is applied to the ArkWebOptions object (i.e., the default configuration object for the target component), and the loaded configuration file provides initial values for ArkWebOptions, which directly affects the behavior of WebView. This is not limited in the embodiments of the present invention.
[0113] Optionally, the above-mentioned execution of corresponding component controller creation operation and corresponding initial state setting operation on the basic component controller is illustrated by, for example: creating a WebviewController instance (ie, component controller) and setting the initial state, which is not limited in the embodiment of the present invention.
[0114] Optionally, the above-mentioned execution of corresponding interface object creation operations and corresponding interface object registration operations on the basic interface object and the target component, for example: registering the developer's customized JavaScript interface object in WebView, the registered interface allows JavaScript to call native code, realize two-way interaction, and improve development convenience. The embodiment of the present invention does not limit this.
[0115] Optionally, dynamic registration of JavaScript interfaces is supported. Developers can expose ArkTS objects to Web pages through simple configuration to achieve two-way communication. Developers can centrally manage WebView parameters through configuration objects in the following specific steps: Step 1: Initialize the configuration manager and create an instance of the configuration manager; Step 2: Load the default configuration. If necessary, you can load the default configuration; Step 3: Update the configuration and update the WebView parameters through the configuration object; Step 4: Get the current configuration and view the current configuration status; Step 5: Create a WebView instance; Step 6: Apply the configuration to the WebView instance; Step 7: Verify the configuration application and check the status of the WebView instance to ensure that the configuration has been applied correctly; further, all WebView parameters are concentrated in a configuration object for easy maintenance and modification; developers can easily adjust the behavior of WebView through the configuration object without modifying the underlying code; new configuration items can be easily added to adapt to different needs; through a unified management mechanism, ensure that the configuration of all WebView instances is consistent, which is not limited in the embodiments of the present invention.
[0116] Optionally, this solution provides a unified configuration management mechanism, and developers can centrally manage various parameters of WebView through configuration objects, that is, uniformly set and modify the behavior of WebView (such as cache mode, JavaScript access rights, etc.), thereby improving code maintainability; further, it may specifically include but is not limited to DOM storage access rights, JavaScript access rights, file access rights, image access rights, online image access rights, scroll mode, mixed content mode, zoom rights, overview mode rights, database access rights, geographic location rights, media playback gesture rights, multi-window rights, horizontal scroll bar rights, vertical scroll bar rights, cache mode, copy options, text zoom ratio, initial zoom ratio, whether to block network requests, default fixed font size, default font size, minimum font size, minimum logical font size, Web fixed font, Web sans serif font, Web serif font, etc. One or more of the following; further, the specific steps for managing WebView parameters through configuration objects may also be: Step 1: Create a configuration object; Step 2: Set parameters, set the behavior of WebView through the configuration object; Step 3: Pass the configuration object to the WebView component; Step 4: Apply the configuration, and apply the parameters of the configuration object to the WebView instance in the build method, which is not limited in the embodiment of the present invention.
[0117] It can be seen that this optional embodiment can realize component initialization through property configuration operations, component controller creation operations, initial state setting operations, interface object creation and registration operations, which is conducive to improving the comprehensiveness, integrity and rationality of the component initialization method, and thus is conducive to improving the targetedness, accuracy and reliability of component initialization, thereby helping to improve the accuracy and efficiency of component management and control, and realize two-way interaction.
[0118] In another optional embodiment, the above-mentioned execution of corresponding logging operations based on the event processing result to obtain the logging result may include:
[0119] Determine first routine event operation information that needs to be logged and output based on the event processing result and the pending event;
[0120] According to the event processing result, determine each type of information corresponding to the event itself and the processing operation of the event to be processed and its criticality, and determine the second critical event operation information that needs to be logged and output according to the criticality of each type of information;
[0121] Corresponding log recording operations are performed on the first regular event operation information and the second key event operation information to obtain log recording results.
[0122] Optionally, during event processing and function expansion, key events and operations (such as page loading time, error information, etc.) are recorded. Logging is a monitoring of the system operating status, which facilitates problem troubleshooting and performance optimization. Furthermore, the log information is output to a console, file or remote server to provide runtime information for developers. This is not limited in the embodiments of the present invention.
[0123] Optionally, the criticality of each type of information may be related to the scope of influence, degree of influence, coreness, importance, involved fields, involved objects, abnormality, regularity, specific effects, etc. of the information of that type, which is not limited in the embodiments of the present invention.
[0124] It can be seen that this optional embodiment can provide a log recording function for routine event operation information and key event operation information, which is conducive to improving the comprehensiveness and rationality of the log recording method, and then conducive to improving the pertinence, accuracy and reliability of the log recording, thereby facilitating subsequent operation status monitoring and / or system development based on the log recording content, and is conducive to improving the application accuracy and efficiency of the log recording content.
[0125] Example 2
[0126] See also Figure 2 , Figure 2 This is a flow chart of another intelligent expansion method for WebView components disclosed in an embodiment of the present invention. Figure 2 The method described can be applied to an electronic device equipped with a HarmonyOS NEXT system, in which an application is installed, and the electronic device is in communication connection with a network attached storage device, and the electronic device can access the network attached storage device through the application, which is not limited in the embodiment of the present invention. Figure 2 As shown, the intelligent extension method for the WebView component includes the following operations:
[0127] 201. Perform corresponding initialization operations on the target component to obtain a component initialization result.
[0128] 202. Based on the component initialization result, execute the corresponding event monitoring operation to obtain the event to be processed.
[0129] 203. Determine a corresponding event processing framework based on the event to be processed, and determine a corresponding event execution logic based on the event to be processed and the event processing framework. The event execution logic includes a default type logic or a custom type logic.
[0130] Optionally, the event is passed to an event processing framework (such as ArkWebClient) to execute default or custom logic, which is not limited in this embodiment of the present invention.
[0131] Optionally, for custom type logic, specifically, in the event processing framework, the developer can implement custom logic (such as intercepting URLs, modifying page content, etc.), which is not limited in the embodiments of the present invention.
[0132] Optionally, this solution provides a unified event processing framework that supports configuring custom event processing logic, reduces repetitive code writing, and improves development efficiency. Specifically, the core structure of the event processing framework is designed: an event registration mechanism that allows developers to register event listeners; an event distribution mechanism that distributes events to corresponding listeners based on event types; an event processing mechanism that executes the processing logic defined in the listener; further, the combination of centralized configuration management: defining the mapping of event types and listeners through configuration objects to achieve centralized management, making WebView configuration items easier to manage and maintain, and reducing code complexity; further, all event processing logic is concentrated in one framework for easy maintenance and expansion. Developers can easily add new event types and listeners, separate event capture and processing logic, and reduce code coupling. This is not limited in the embodiments of the present invention.
[0133] 204. Determine the general component function information of the target component and the required function information corresponding to the event to be processed, and judge whether the event to be processed meets the preset function extension call conditions based on the general component function information and the required function information. When the judgment result is yes, execute step 206; when the judgment result is no, execute step 205.
[0134] 205. According to the event execution logic, the corresponding basic event processing operation is performed on the event to be processed to obtain the event processing result.
[0135] 206. According to the conventional component function information, the required function information and the event execution logic, the corresponding basic and function extension event processing operations are performed on the event to be processed to obtain the event processing result.
[0136] Optionally, the above-mentioned function extension event processing operation is illustrated by an example: during the event processing process, an extension module (such as file selection, permission management, etc.) is called to process specific requirements, and the processing result of the extension module is returned to WebView or JavaScript. The extension module is a supplement to the WebView function and is used to handle the requirements of complex or specific scenarios. The processing result is the final output of the function extension, which directly affects the user experience. The embodiment of the present invention does not limit this.
[0137] Optionally, extension modules (such as file selection, permission management, pop-up window processing, etc.) support the implementation of complex business scenarios, improve the user experience, and through modular design and extensibility interfaces, developers can flexibly expand WebView functions according to business needs and reduce development costs. This is not limited in the embodiments of the present invention.
[0138] 207. Based on the event processing result, perform corresponding log recording operations to obtain log recording results, and the log recording results are used for system operation status monitoring and / or system development.
[0139] In the embodiment of the present invention, for other descriptions of steps 201 to 207, please refer to the other detailed descriptions of steps 101 to 104 in the first embodiment, which will not be repeated in the embodiment of the present invention.
[0140] It can be seen that the embodiments of the present invention can realize the intelligent extension function of the component through initialization operations, event monitoring operations, function extension and event processing operations, log recording operations, etc., which is conducive to improving the comprehensiveness, integrity and rationality of the intelligent extension method for the component, thereby improving the functional extensibility of the component, improving the flexibility, convenience and efficiency of the functional extension of the component, and improving the accuracy and reliability of the functional extension of the component, thereby improving the event processing efficiency and event processing accuracy, improving development efficiency and development convenience, reducing the maintenance and management difficulty of the component, and improving the accuracy and efficiency of maintenance and management, further facilitating the optimization of the implementation effect and user experience for different business scenarios; and, it can also provide an event execution logic determination method, which is conducive to improving the comprehensiveness and rationality of the event execution logic determination method, thereby facilitating the improvement of the accuracy and reliability of the determined event execution logic; and, it can also match corresponding event processing operations for events to be processed that meet the function extension call conditions and events that do not meet the function extension call conditions, thereby facilitating the improvement of the comprehensiveness, integrity and rationality of the event processing method for the events to be processed, and facilitating the improvement of the diversity, flexibility and pertinence of the event processing method for the events to be processed, thereby facilitating the improvement of the accuracy and reliability of the event processing for the events to be processed.
[0141] In an optional embodiment, the above-mentioned execution of corresponding basic and function-extended event processing operations on the event to be processed based on the conventional component function information, the required function information and the event execution logic to obtain the event processing result may include:
[0142] Determine the target specific required function corresponding to the event to be processed based on the general component function information and the required function information, and determine the target extension module corresponding to the target specific required function;
[0143] Based on the event execution logic, the corresponding basic event processing operations are performed on the event to be processed. Also, based on the target extension module and the target specific requirement function, the corresponding function extension event processing operations are performed on the event to be processed to obtain the event processing result.
[0144] Optionally, the target specific requirement function may be a requirement function for processing complex or specific scenarios, which is not limited in the embodiment of the present invention.
[0145] Optionally, when the required function information only includes a specific required function, the above-mentioned execution of a corresponding basic event processing operation on the event to be processed may also be an empty processing operation, which is not limited in the embodiment of the present invention.
[0146] It can be seen that this optional embodiment can provide specific basic and functional expansion event processing methods for events to be processed, which is conducive to improving the comprehensiveness and rationality of the basic and functional expansion event processing methods, and thus is conducive to improving the pertinence, fit and accuracy of the basic event processing methods and functional expansion event processing methods for events to be processed, thereby helping to improve the accuracy and reliability of the basic event processing of events to be processed, as well as helping to improve the accuracy and reliability of the functional expansion event processing of events to be processed, thereby helping to improve the accuracy and reliability of the determined event processing results.
[0147] In another optional embodiment, the above-mentioned determination of the corresponding event execution logic based on the event to be processed and the event processing framework may include:
[0148] Determine whether the event to be processed meets the preset regular logic requirements;
[0149] When it is determined that the event to be processed meets the conventional logic requirements, the target default type logic is determined according to the event to be processed, the event processing framework and the preset default type logic set as the corresponding event execution logic;
[0150] When it is determined that the event to be processed does not meet the conventional logic requirement conditions, it is determined whether the event to be processed meets the preset historical custom logic conditions;
[0151] When it is determined that the event to be processed meets the historical custom logic conditions, the first target custom type logic is determined as the corresponding event execution logic based on the event to be processed, the event processing framework, and the preset historical custom type logic set;
[0152] When it is determined that the event to be processed does not meet the pre-defined logical conditions, the second target custom type logic is determined as the corresponding event execution logic based on the collected user custom operations for the matching logic of the event to be processed and the event processing framework.
[0153] Further optionally, the above-mentioned determination of whether the event to be processed meets the preset conventional logic requirement conditions may include:
[0154] Determine whether the pending event is processed by the normal default logic;
[0155] When the judgment result is yes, it is determined that the event to be processed meets the preset regular logic requirement conditions;
[0156] When the judgment result is no, it is determined that the event to be processed does not meet the preset conventional logic requirement condition.
[0157] Further optionally, the above-mentioned determination of whether the event to be processed meets the preset historical custom logic condition may include:
[0158] Determine whether the execution logic of the required event of the event to be processed meets the pre-defined conditions;
[0159] When the judgment result is yes, it is determined that the event to be processed meets the preset historical custom logic condition;
[0160] When the judgment result is no, it is determined that the event to be processed does not meet the preset historical custom logic condition.
[0161] Optionally, for example: when the demand event execution logic of the event to be processed is the default logic, the target default type logic is directly called; when the demand event execution logic of the event to be processed is not the default logic, further, when the demand event execution logic of the event to be processed has been customized in advance, the target historical customized type logic is called, further, when the demand event execution logic of the event to be processed has not been customized in advance, the developer customizes or the system intelligently generates the customized type logic corresponding to the event to be processed as the corresponding event execution logic, which is not limited in the embodiments of the present invention.
[0162] It can be seen that this optional embodiment can match the corresponding event execution logic determination method by determining whether the conventional logical requirement conditions of the event to be processed and the historical custom logical conditions are satisfied, which is conducive to improving the comprehensiveness, integrity and rationality of the event execution logic determination method of the event to be processed, and is conducive to improving the diversity, flexibility and pertinence of the event execution logic determination method of the event to be processed, and thus is conducive to improving the accuracy and reliability of the determined event execution logic, thereby helping to improve the accuracy and reliability of subsequent event processing results based on the event execution logic.
[0163] In another optional embodiment, the above-mentioned determination of whether the event to be processed meets the preset function extension calling condition based on the conventional component function information and the required function information may include:
[0164] Determining a first processing function based on conventional component function information, and determining a second processing function based on required function information;
[0165] determining whether the first processing function matches the second processing function;
[0166] When it is determined that the first processing function matches the second processing function, determining that the event to be processed does not meet the preset function extension calling condition;
[0167] When it is determined that the first processing function does not match the second processing function, it is determined that the event to be processed meets a preset function extension calling condition.
[0168] Optionally, the determining whether the first processing function matches the second processing function may include:
[0169] determining whether the first processing function completely includes the second processing function;
[0170] When the judgment result is yes, determining that the first processing function matches the second processing function;
[0171] When the judgment result is negative, it is determined that the first processing function does not match the second processing function.
[0172] Furthermore, the first processing function does not completely include the second processing function. The first processing function may include part of the second processing function, or the first processing function may not include the second processing function at all. This is not limited in the embodiment of the present invention.
[0173] It can be seen that this optional embodiment can determine the function extension call condition satisfaction result of the event to be processed through the matching situation of the first processing function corresponding to the conventional component function information and the second processing function corresponding to the requirement function information, which is conducive to improving the comprehensiveness, integrity and rationality of the method for determining the function extension call condition satisfaction result, and thus is conducive to improving the accuracy and reliability of the determined function extension call condition satisfaction result, thereby helping to improve the accuracy and reliability of the event processing operation triggered by the function extension call condition satisfaction result.
[0174] Example 3
[0175] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of an intelligent expansion device for a WebView component disclosed in an embodiment of the present invention. Figure 3 The described device may include an electronic device equipped with a HarmonyOS NEXT system, an application installed in the electronic device, the electronic device is in communication connection with a network attached storage device, and the electronic device can access the network attached storage device through the application, which is not limited in the embodiment of the present invention. Figure 3 As shown, the intelligent expansion device for the WebView component may include:
[0176] The initialization module 301 is used to perform corresponding initialization operations on the target component to obtain a component initialization result.
[0177] The event monitoring module 302 is used to perform corresponding event monitoring operations based on the component initialization result to obtain the event to be processed.
[0178] The event processing module 303 is used to determine the event execution logic based on the event to be processed, and to determine the conventional component function information of the target component and the required function information corresponding to the event to be processed, and to perform corresponding basic processing and / or function extension processing operations on the event to be processed based on the event execution logic, conventional component function information and required function information to obtain the event processing result.
[0179] The log recording module 304 is used to perform corresponding log recording operations based on the event processing results to obtain log recording results. The log recording results are used for system operation status monitoring and / or system development.
[0180] It can be seen that implementation Figure 3 The described intelligent extension device for the WebView component can realize the intelligent extension function of the component through initialization operations, event monitoring operations, function extension and event processing operations, logging operations, etc., which is conducive to improving the comprehensiveness, integrity and rationality of the intelligent extension method for the component, and thus is conducive to improving the functional extensibility of the component, and is conducive to improving the flexibility, convenience and efficiency of the functional extension of the component, as well as improving the accuracy and reliability of the functional extension of the component, thereby helping to improve event processing efficiency and event processing accuracy, improve development efficiency and development convenience, reduce the difficulty of component maintenance and management, improve the accuracy and efficiency of maintenance management, and further help to optimize the implementation effect and user experience for different business scenarios.
[0181] In an optional embodiment, the initialization module 301 performs corresponding initialization operations on the target component, and obtains the component initialization result in the following manner:
[0182] Determine the initial parameter information corresponding to the target component according to the preset configuration file, and perform corresponding attribute configuration operations on the pre-created default configuration object for the target component according to the initial parameter information;
[0183] Based on the target component, perform the corresponding component controller creation operation to obtain the basic component controller, and perform the corresponding initial state setting operation on the basic component controller to obtain the target component corresponding to the target component;
[0184] Based on the target component, the corresponding interface object creation operation is performed to obtain the basic interface object, and the corresponding interface object registration operation is performed on the basic interface object and the target component to obtain the interface object registration result to realize the two-way communication function corresponding to the target component.
[0185] It can be seen that implementation Figure 3 The described device can also realize component initialization through attribute configuration operations, component controller creation operations, initial state setting operations, interface object creation and registration operations, which is conducive to improving the comprehensiveness, integrity and rationality of component initialization methods, and thus is conducive to improving the targetedness, accuracy and reliability of component initialization, thereby helping to improve the accuracy and efficiency of component management and control, and realize two-way interaction.
[0186] In another optional embodiment, the event processing module 303 determines the event execution logic according to the event to be processed, specifically including:
[0187] Determine the corresponding event processing framework based on the event to be processed, and determine the corresponding event execution logic based on the event to be processed and the event processing framework. The event execution logic includes default type logic or custom type logic.
[0188] Furthermore, the event processing module 303 performs corresponding basic processing and / or function extension processing operations on the event to be processed according to the event execution logic, conventional component function information, and required function information. The event processing result is obtained in the following manner:
[0189] Based on the general component function information and the required function information, determine whether the event to be processed meets the preset function extension call conditions;
[0190] When it is determined that the event to be processed does not meet the function extension call conditions, the corresponding basic event processing operation is performed on the event to be processed according to the event execution logic to obtain the event processing result;
[0191] When it is determined that the event to be processed meets the function extension call conditions, the corresponding basic and function extension event processing operations are performed on the event to be processed according to the conventional component function information, the required function information and the event execution logic to obtain the event processing result.
[0192] It can be seen that implementation Figure 3The described device can also provide a method for determining event execution logic, which is conducive to improving the comprehensiveness and rationality of the method for determining event execution logic, and thus is conducive to improving the accuracy and reliability of the determined event execution logic; in addition, corresponding event processing operations are matched for events to be processed that meet the function extension call conditions and events that do not meet the function extension call conditions, which is conducive to improving the comprehensiveness, integrity and rationality of the event processing method for events to be processed, as well as improving the diversity, flexibility and pertinence of the event processing method for events to be processed, and thus is conducive to improving the accuracy and reliability of event processing for events to be processed.
[0193] In another optional embodiment, the event processing module 303 performs corresponding basic and function-extended event processing operations on the event to be processed based on the conventional component function information, the required function information, and the event execution logic, and obtains the event processing result in the following manner:
[0194] Determine the target specific required function corresponding to the event to be processed based on the general component function information and the required function information, and determine the target extension module corresponding to the target specific required function;
[0195] Based on the event execution logic, the corresponding basic event processing operations are performed on the event to be processed. Also, based on the target extension module and the target specific requirement function, the corresponding function extension event processing operations are performed on the event to be processed to obtain the event processing result.
[0196] It can be seen that implementation Figure 3 The described device can also provide specific basic and functional extension event processing methods for events to be processed, which is conducive to improving the comprehensiveness and rationality of the basic and functional extension event processing methods, and thus is conducive to improving the pertinence, fit and accuracy of the basic event processing methods and functional extension event processing methods for events to be processed, thereby helping to improve the accuracy and reliability of the basic event processing of events to be processed, as well as helping to improve the accuracy and reliability of the functional extension event processing of events to be processed, thereby helping to improve the accuracy and reliability of the determined event processing results.
[0197] In another optional embodiment, the event processing module 303 determines the corresponding event execution logic according to the event to be processed and the event processing framework, specifically including:
[0198] Determine whether the event to be processed meets the preset regular logic requirements;
[0199] When it is determined that the event to be processed meets the conventional logic requirements, the target default type logic is determined according to the event to be processed, the event processing framework and the preset default type logic set as the corresponding event execution logic;
[0200] When it is determined that the event to be processed does not meet the conventional logic requirement conditions, it is determined whether the event to be processed meets the preset historical custom logic conditions;
[0201] When it is determined that the event to be processed meets the historical custom logic conditions, the first target custom type logic is determined as the corresponding event execution logic based on the event to be processed, the event processing framework, and the preset historical custom type logic set;
[0202] When it is determined that the event to be processed does not meet the pre-defined logical conditions, the second target custom type logic is determined as the corresponding event execution logic based on the collected user custom operations for the matching logic of the event to be processed and the event processing framework.
[0203] It can be seen that implementation Figure 3 The described device can also match the corresponding event execution logic determination method by determining whether the conventional logical requirement conditions of the event to be processed and the historical custom logical conditions are met, which is conducive to improving the comprehensiveness, integrity and rationality of the event execution logic determination method of the event to be processed, and is conducive to improving the diversity, flexibility and pertinence of the event execution logic determination method of the event to be processed, and thus is conducive to improving the accuracy and reliability of the determined event execution logic, thereby helping to improve the accuracy and reliability of subsequent event processing results based on the event execution logic.
[0204] In another optional embodiment, the event processing module 303 determines whether the event to be processed meets the preset function extension calling condition according to the conventional component function information and the required function information in the following manner:
[0205] Determining a first processing function based on conventional component function information, and determining a second processing function based on required function information;
[0206] determining whether the first processing function matches the second processing function;
[0207] When it is determined that the first processing function matches the second processing function, determining that the event to be processed does not meet the preset function extension calling condition;
[0208] When it is determined that the first processing function does not match the second processing function, it is determined that the event to be processed meets a preset function extension calling condition.
[0209] It can be seen that implementation Figure 3The described device can also determine the function extension call condition satisfaction result of the event to be processed through the matching situation of the first processing function corresponding to the conventional component function information and the second processing function corresponding to the required function information, which is conducive to improving the comprehensiveness, integrity and rationality of the method for determining the function extension call condition satisfaction result, and thus is conducive to improving the accuracy and reliability of the determined function extension call condition satisfaction result, thereby helping to improve the accuracy and reliability of the event processing operation triggered by the function extension call condition satisfaction result.
[0210] In another optional embodiment, the log recording module 304 performs corresponding log recording operations based on the event processing result, and the manner of obtaining the log recording result specifically includes:
[0211] Determine first routine event operation information that needs to be logged and output based on the event processing result and the pending event;
[0212] According to the event processing result, determine each type of information corresponding to the event itself and the processing operation of the event to be processed and its criticality, and determine the second critical event operation information that needs to be logged and output according to the criticality of each type of information;
[0213] Corresponding log recording operations are performed on the first regular event operation information and the second key event operation information to obtain log recording results.
[0214] It can be seen that implementation Figure 3 The described device can also provide a log recording function for routine event operation information and key event operation information, which is conducive to improving the comprehensiveness and rationality of the log recording method, and thus is conducive to improving the pertinence, accuracy and reliability of the log recording, thereby facilitating subsequent operation status monitoring and / or system development based on the log recording content, and is conducive to improving the application accuracy and efficiency of the log recording content.
[0215] Example 4
[0216] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. Figure 4 The electronic device described may include a server, wherein the server includes a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 4 As shown, the electronic device may include:
[0217] A memory 401 storing executable program code;
[0218] a processor 402 coupled to the memory 401;
[0219] Furthermore, it may also include an input interface 403 and an output interface 404 coupled to the processor 402;
[0220] The processor 402 calls the executable program code stored in the memory 401 to execute the steps of the intelligent expansion method for the WebView component described in the first or second embodiment.
[0221] Example 5
[0222] An embodiment of the present invention discloses a computer storage medium storing a computer program for electronic data exchange, wherein the computer program enables a computer to execute the steps of the intelligent expansion method for the WebView component described in the first or second embodiment.
[0223] Example 6
[0224] An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable a computer to execute the steps of the intelligent expansion method for the WebView component described in Example 1 or Example 2.
[0225] Example 7
[0226] The embodiment of the present invention discloses an intelligent expansion system for a WebView component. The system may include the intelligent expansion device for a WebView component described in the third embodiment, and a network attached storage device in communication with the device; or
[0227] The system may include the electronic device described in the fourth embodiment, and a network attached storage device communicatively connected to the electronic device.
[0228] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Those skilled in the art can understand and implement the present invention without inventive effort.
[0229] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, the storage medium including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0230] Finally, it should be noted that the intelligent expansion method, device and system for the WebView component disclosed in the embodiments of the present invention are only preferred embodiments of the present invention, which are only used to illustrate the technical solutions of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. An intelligent expansion method for a WebView component, the method being applied to an electronic device equipped with a HarmonyOS NEXT system, wherein the electronic device has an application installed therein, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application, characterized in that: The method comprises: Perform corresponding initialization operations on the target component to obtain the component initialization result; Based on the component initialization result, execute the corresponding event monitoring operation to obtain the event to be processed; Determine an event execution logic according to the event to be processed, determine the conventional component function information of the target component and the required function information corresponding to the event to be processed, and perform corresponding basic processing and / or function extension processing operations on the event to be processed according to the event execution logic, the conventional component function information and the required function information to obtain an event processing result; Based on the event processing result, a corresponding log recording operation is performed to obtain a log recording result, and the log recording result is used for system operation status monitoring and / or system development.
2. The intelligent expansion method for the WebView component according to claim 1, characterized in that: The performing of the corresponding initialization operation on the target component to obtain the component initialization result includes: Determine the initial parameter information corresponding to the target component according to the preset configuration file, and perform corresponding attribute configuration operations on the pre-created default configuration object for the target component according to the initial parameter information; Based on the target component, a corresponding component controller creation operation is performed to obtain a basic component controller, and a corresponding initial state setting operation is performed on the basic component controller to obtain a target component controller corresponding to the target component; Based on the target component, the corresponding interface object creation operation is performed to obtain the basic interface object, and the corresponding interface object registration operation is performed on the basic interface object and the target component to obtain the interface object registration result to realize the two-way communication function corresponding to the target component.
3. The intelligent expansion method for the WebView component according to claim 1, characterized in that: The determining of event execution logic according to the event to be processed includes: Determine a corresponding event processing framework according to the event to be processed, and determine a corresponding event execution logic according to the event to be processed and the event processing framework, wherein the event execution logic includes a default type logic or a custom type logic; Furthermore, performing corresponding basic processing and / or function extension processing operations on the event to be processed according to the event execution logic, the conventional component function information, and the required function information to obtain an event processing result includes: Determining whether the event to be processed meets a preset function extension calling condition based on the conventional component function information and the required function information; When it is determined that the event to be processed does not meet the function extension calling condition, performing a corresponding basic event processing operation on the event to be processed according to the event execution logic to obtain an event processing result; When it is determined that the event to be processed meets the function extension call condition, the corresponding basic and function extension event processing operations are performed on the event to be processed according to the conventional component function information, the required function information and the event execution logic to obtain an event processing result.
4. The intelligent expansion method for the WebView component according to claim 3, characterized in that: The step of performing corresponding basic and function-extended event processing operations on the event to be processed based on the conventional component function information, the required function information, and the event execution logic to obtain an event processing result includes: Determine the target specific demand function corresponding to the event to be processed according to the conventional component function information and the demand function information, and determine the target extension module corresponding to the target specific demand function; Based on the event execution logic, a corresponding basic event processing operation is performed on the event to be processed, and based on the target extension module and the target specific requirement function, a corresponding function extension event processing operation is performed on the event to be processed to obtain an event processing result.
5. The intelligent expansion method for the WebView component according to claim 3, characterized in that: Determining corresponding event execution logic according to the event to be processed and the event processing framework includes: Determine whether the event to be processed meets the preset conventional logic requirement conditions; When it is determined that the event to be processed meets the conventional logic requirement, a target default type logic is determined according to the event to be processed, the event processing framework and the preset default type logic set as the corresponding event execution logic; When it is determined that the event to be processed does not meet the conventional logic requirement condition, it is determined whether the event to be processed meets the preset historical custom logic condition; When it is determined that the event to be processed meets the historical custom logic condition, a first target custom type logic is determined as the corresponding event execution logic according to the event to be processed, the event processing framework, and a preset historical custom type logic set; When it is determined that the event to be processed does not meet the pre-defined logical conditions, a second target custom type logic is determined as the corresponding event execution logic based on the collected user's custom operation of matching the event to be processed and the event processing framework.
6. The intelligent expansion method for the WebView component according to any one of claims 3 to 5, characterized in that: The determining, based on the conventional component function information and the required function information, whether the to-be-processed event satisfies a preset function extension calling condition includes: Determining a first processing function based on the conventional component function information, and determining a second processing function based on the required function information; determining whether the first processing function matches the second processing function; When it is determined that the first processing function matches the second processing function, determining that the event to be processed does not meet a preset function extension calling condition; When it is determined that the first processing function does not match the second processing function, it is determined that the event to be processed meets a preset function extension calling condition.
7. The intelligent expansion method for the WebView component according to any one of claims 1 to 5, characterized in that: The performing of corresponding log recording operations based on the event processing result to obtain a log recording result includes: Determining first regular event operation information that needs to be logged and output according to the event processing result and the event to be processed; Determine, based on the event processing result, each type of information corresponding to the event itself and the processing operation of the event to be processed and its criticality, and determine, based on the criticality of each type of information, second critical event operation information that needs to be logged and output; Corresponding log recording operations are performed on the first regular event operation information and the second key event operation information to obtain log recording results.
8. An intelligent expansion device for WebView components, characterized in that: The apparatus includes an electronic device equipped with a HarmonyOS NEXT system, an application installed in the electronic device, the electronic device being communicatively connected to a network attached storage device, and the electronic device being able to access the network attached storage device through the application, and the apparatus including: The initialization module is used to perform corresponding initialization operations on the target component and obtain the component initialization result; An event monitoring module is used to perform corresponding event monitoring operations based on the component initialization result to obtain the event to be processed; An event processing module is used to determine an event execution logic based on the event to be processed, and determine the conventional component function information of the target component and the required function information corresponding to the event to be processed, and perform corresponding basic processing and / or function extension processing operations on the event to be processed based on the event execution logic, the conventional component function information and the required function information to obtain an event processing result; The log recording module is used to perform corresponding log recording operations based on the event processing results to obtain log recording results, and the log recording results are used for system operation status monitoring and / or system development.
9. An electronic device, characterized in that: The electronic device comprises: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the intelligent expansion method for the WebView component according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that The computer storage medium stores computer instructions, which, when called, are used to execute the intelligent expansion method for the WebView component according to any one of claims 1 to 7.
11. An intelligent expansion system for WebView components, characterized in that: The system comprises the intelligent expansion device for the WebView component as claimed in claim 8, and a network attached storage device communicatively connected to the device; or, The system comprises the electronic device according to claim 9, and a network attached storage device communicatively connected to the electronic device.
Citation Information
Patent Citations
Information extension method and device and electronic equipment
CN112214252A
Page display method and device
CN113760263A
Application generation method and device, equipment and medium
CN114327380A