CN108845800B - Method, device, equipment and storage medium for realizing component extension function - Google Patents

Method, device, equipment and storage medium for realizing component extension function Download PDF

Info

Publication number
CN108845800B
CN108845800B CN201810503377.7A CN201810503377A CN108845800B CN 108845800 B CN108845800 B CN 108845800B CN 201810503377 A CN201810503377 A CN 201810503377A CN 108845800 B CN108845800 B CN 108845800B
Authority
CN
China
Prior art keywords
module
extension module
component
configuration file
script language
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810503377.7A
Other languages
Chinese (zh)
Other versions
CN108845800A (en
Inventor
杨文鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN201810503377.7A priority Critical patent/CN108845800B/en
Publication of CN108845800A publication Critical patent/CN108845800A/en
Application granted granted Critical
Publication of CN108845800B publication Critical patent/CN108845800B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Abstract

The invention discloses a method, a device, equipment and a storage medium for realizing the extended function of a component, wherein the method comprises the following steps: generating an extension module based on common logic data contained in a module management component Modulemanager; configuring the expansion module into a configuration file; judging whether a target expansion module is configured in the configuration file or not through a ModuleManager, wherein the first script language component is registered in the native system; based on the second script language component, calling the first script language component through the target extension module to perform corresponding service operation; according to the method, the device, the equipment and the storage medium, the application program generates the extension module through the Modulemanager, and the module management component comprises common logic data for generating the extension module. Therefore, when the application program needs to generate different extension modules due to update iteration, the common logic data can be directly called without writing and repeatedly writing the common logic data, and the code fault tolerance is improved.

Description

Method, device, equipment and storage medium for realizing component extension function
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a method, an apparatus, a device, and a storage medium for implementing a component extension function.
Background
With the development of internet technology and smart terminal technology, various applications have been popularized in various aspects of mass life, such as viewing, shopping, payment, social contact, providing various information, and the like. At present, the applications of these intelligent terminals are often implemented by Native apps (Native apps), and the Native apps are implemented by using an API (Application Programming Interface) provided by a Native operating system, so that high performance and good interactive experience of the applications can be ensured.
In the existing Native App update iteration process, a Native App page is a page generated by loading a uniform resource locator url through a web view webview. Specifically, through update iteration of the Native App, the Native App pages need to be drawn in a way of webview loading javaScript, so that java codes need to be called by many Native App pages, for example, a database of an android system android, a network access, log printing, a sharing component with an android platform packaged perfectly, and the like.
However, at present, developers write data of corresponding project modules through javaScript only according to the requirement of each Native App iteration update, which results in that many repeated functional codes need to be rewritten for each update iteration, so that the code fault tolerance of each page is reduced.
Disclosure of Invention
The invention mainly aims to provide a method, a device, equipment and a storage medium for realizing a component extension function, which solve the problem that in the prior art, an application program needs to repeatedly write common logic codes when performing iterative update.
According to a first aspect of the present invention, there is provided a method for implementing component extension function, which is applied to an application program developed based on a hybrid development mode, the method including: generating an extension module based on common logic data contained in a module management component Modulemanager; initializing a software development kit to configure the extension module into a configuration file; when a second script language component accesses a first script language component based on a target extension module, judging whether the target extension module is configured in the configuration file or not through the ModuleManager, wherein the first script language component is registered in a native system; and under the condition that the target extension module is configured in the configuration file, based on the second script language component, calling the first script language component through the target extension module to perform corresponding business operation.
Optionally, the configuration file includes a list for storing the unique identifier of the extension module in the configuration file; the determining, by the ModuleManager, whether the target extension module is configured in the configuration file includes: inquiring the list through the ModuleManager, and judging whether the list stores the unique identifier of the target expansion module; and if so, determining that the destination extension module is configured in the configuration file.
Optionally, the unique identifier includes a name of the extension module.
Optionally, in a case that it is determined that the target extension module is configured in the configuration file, the method further includes: and feeding back prompt information to the second script language component through the Modulemanager to determine that the first script language component is called by the target extension module to perform corresponding business operation based on the second script language component.
According to a second aspect of the present invention, there is provided an apparatus for implementing component extension function, included in an application program developed based on a hybrid development mode, the apparatus including:
the generating module is used for generating an extension module based on the common logic data contained in the module management component Modulemanager; the configuration module is used for initializing a software development kit so as to configure the extension module into a configuration file; the judging module is used for judging whether the target extension module is configured in the configuration file or not through the ModuleManager when the second script language component accesses the first script language component based on the target extension module, wherein the first script language component is registered in a native system; and the calling module is used for calling the first script language component through the target extension module to perform corresponding business operation based on the second script language component under the condition that the target extension module is configured in the configuration file.
Optionally, the configuration file includes a list for storing the unique identifier of the extension module in the configuration file; the judgment module is specifically configured to: inquiring the list through the ModuleManager, and judging whether the list stores the unique identifier of the target expansion module; and if so, determining that the destination extension module is configured in the configuration file.
Optionally, the unique identifier includes a name of the extension module.
Optionally, the apparatus further comprises: and the prompt module is used for feeding back prompt information to the second script language component through the Modulemanager under the condition that the target extension module is configured in the configuration file so as to determine that the first script language component is called by the target extension module to perform corresponding business operation based on the second script language component.
According to a third aspect of the present invention, there is provided an electronic device comprising a processor and a memory;
the memory is used for storing computer instructions, and the processor is used for executing the computer instructions stored by the memory to realize the implementation method of the component expansion function.
According to a fourth aspect of the present invention, there is provided a computer-readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement a method for implementing a component extension function as described above.
The invention has the following beneficial effects: the application generates an extension module via the module manager, and because the module manager includes common logical data for generating the extension module. Therefore, when the application program needs to generate different extension modules due to update iteration, the common logic data can be directly called without writing and repeatedly writing the common logic data, and the code fault tolerance is improved.
In addition, the application generates an extension module through the ModuleManager, that is: the generated extension module is packaged in the module management component Modulemanager. After the application program uses the packaged extension module, the calling speed of the extension module in the second script language component for calling the native platform is reduced, and certainly, the page rendering speed is increased, so that a user can see a page more quickly, and the time cost of the user is saved. Moreover, flexible configuration and modification of the extension module by developers can be effectively improved through the encapsulation of the extension module, so that the codes of the extension module achieve high cohesion and low coupling.
Drawings
Fig. 1 is a flow chart of a method for implementing component extension functions according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for implementing component extension functions according to a second embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for implementing component extension functions according to a third embodiment of the present invention;
fig. 4 is a flowchart of a method for implementing a component extension function according to a fourth embodiment of the present invention;
fig. 5 is a schematic diagram of an extension module implementing a corresponding protocol in a method for implementing a component extension function according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of an apparatus for implementing an expansion function of a component according to a fifth embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the following description, suffixes such as "module", "part", or "unit" used to indicate elements are used only for facilitating the description of the present invention, and have no particular meaning in themselves. Thus, "module", "component" or "unit" may be used mixedly.
It will be understood that, although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element may be termed a second element, and, similarly, a second element may be termed a first element, without departing from the scope of example embodiments. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
In order to facilitate understanding of the embodiments of the present invention, the following detailed description of the embodiments of the present invention is provided.
A first embodiment of the present invention provides a method for implementing a component extension function, which is applied to an application program developed based on a hybrid development mode, and the method includes: generating an extension module based on common logic data contained in a module management component Modulemanager; initializing a software development kit to configure the extension module into a configuration file; when a second script language component accesses a first script language component based on a target extension module, judging whether the target extension module is configured in the configuration file or not through the ModuleManager, wherein the first script language component is registered in a native system; and under the condition that the target extension module is configured in the configuration file, based on the second script language component, calling the first script language component through the target extension module to perform corresponding business operation.
In this regard, the application generates extension modules via the module management component ModuleManager, and because the module management component includes common logical data for generating the extension modules. Therefore, when the application program needs to generate different extension modules due to update iteration, the common logic data can be directly called without writing and repeatedly writing the common logic data, and the code fault tolerance is improved.
In addition, the application program generates an extension module through a module management component ModuleManager, namely: the generated extension module is packaged in the module management component Modulemanager. After the application program uses the packaged extension module, the calling speed of calling the native platform by the extension module in the second script language component is reduced, and certainly, the page rendering speed is increased, so that a user can more quickly see a page, and the time cost of the user is saved. Moreover, flexible configuration and modification of the extension module by developers can be effectively improved through the encapsulation of the extension module, so that the codes of the extension module achieve high cohesion and low coupling.
Fig. 1 is a flowchart of a method for implementing a component extension function according to a first embodiment of the present invention. According to fig. 1, a first embodiment of the present invention provides a method for implementing a component extension function, which is applied to an application program developed based on a hybrid development mode, and the method includes:
s11: generating an extension module based on common logic data contained in a module management component Modulemanager;
in this embodiment, the module management module manager includes common logic data for configuring each extension module, and in this embodiment, the application program generates the extension module through the common logic data in the module manager, so as to package the generated extension module to the module management module manager. In this embodiment, the common logic data is logic code.
S12: initializing a software development kit to configure the extension module into a configuration file;
and the application program configures the extension module into a configuration file by initializing the development kit SDK. The configuration file may be configured manually, or of course, may be obtained from the server by the terminal loaded with the application, or may be further obtained dynamically from the server by the terminal loaded with the application through a dynamic framework for hot update.
In the present embodiment, the configuration file includes a layout file XML, and the layout file XML is exemplarily set as an extensible _ config.
S13: when a second script language component accesses a first script language component based on a target extension module, judging whether the target extension module is configured in the configuration file or not through the ModuleManager, wherein the first script language component is registered in a native system; if so, step S14 is executed: otherwise, step S15 is executed.
In this embodiment, when the second scripting language component accesses the first scripting language component based on the target extension module, the application program needs to determine, through the ModuleManager, whether the target extension module is configured in the configuration file. Namely: when the application program is started, the application program needs to judge whether the target extension module is configured in the configuration file through the ModuleManager.
Optionally, before the application program needs to determine whether the target extension module is configured in the configuration file through the ModuleManager, the embodiment of the present invention further includes the following steps:
and the application program reads the target extension module in the configuration file through the first script language component.
Wherein the first scripting language component is registered with the native system. In addition, if the first script language component is installed in the android system, the first script language component can be exemplarily set as an android platform android.
Namely: in this embodiment, the application reads the target extension module in the extensible _ config. Then, the application program needs to determine, through the ModuleManager, whether the extension module read from the configuration file includes the target extension module.
In this embodiment, the type of the first script language for constructing the first script language component is not limited, and only needs to meet the requirements of the embodiment of the present invention, such as: the first script language is Java.
Optionally, the second scripting language component specifically includes: in the hybrid development mode, non-native components corresponding to functions implemented by a program in the native system for building pages.
In this embodiment, the kind of the second scripting language for constructing the second scripting language component is not limited, and only needs to meet the requirements of the embodiment of the present invention, such as: the second scripting language is JavaScript.
S14: and under the condition that the target extension module is configured in the configuration file, based on the second script language component, calling the first script language component through the target extension module to perform corresponding business operation.
And under the condition that the target extension module is configured in the configuration file, the application program calls the first script language component through the target extension module to perform corresponding business operation based on the second script language component.
Specifically, if the target extension module is a module for performing network access, the application program calls the native platform to perform network access through the target extension module based on the second scripting language component.
S15: in the case where it is determined that the target extension module is not configured in the configuration file, the application program does not perform any processing.
In this regard, the application generates extension modules via the module management component ModuleManager, and because the module management component includes common logical data for generating the extension modules. Therefore, when the application program needs to generate different extension modules due to update iteration, the common logic data can be directly called without writing and repeatedly writing the common logic data, and the code fault tolerance is improved.
In addition, the application program generates an extension module through a module management component ModuleManager, namely: the generated extension module is packaged in the module management component ModuleManager. After the application program uses the packaged extension module, the calling speed of the extension module in the second script language component for calling the native platform is reduced, and certainly, the page rendering speed is increased, so that a user can see a page more quickly, and the time cost of the user is saved. Moreover, flexible configuration and modification of the extension module by developers can be effectively improved through the encapsulation of the extension module, so that the codes of the extension module achieve high cohesion and low coupling.
Fig. 2 is a flowchart of a method for implementing a component extension function according to a second embodiment of the present invention. According to fig. 2, a second embodiment of the present invention provides a method for implementing a component extension function, which is applied to an application program developed based on a hybrid development mode, where the method includes:
s21: generating an extension module based on common logic data contained in a module management component Modulemanager;
in this embodiment, the module management module manager includes common logic data for configuring each extension module, and in this embodiment, the application program generates the extension module through the common logic data in the module manager, so as to package the generated extension module to the module management module manager. In this embodiment, the common logic data is logic code.
S22: initializing a software development kit to configure the extension module into a configuration file;
and the application program configures the extension module into a configuration file by initializing the development kit SDK. The configuration file may be configured manually, or of course, may be obtained from the server by the terminal loaded with the application, or may be further obtained dynamically from the server by the terminal loaded with the application through a dynamic framework for hot update.
In the present embodiment, the configuration file includes a layout file XML, and the layout file XML is exemplarily set as an extensible _ config.
S23: when a second scripting language component accesses a first scripting language component on the basis of a target extension module, querying the manifest list through the ModuleManager, and judging whether the unique identifier of the target extension module is stored in the manifest list, wherein the first scripting language component is registered in a native system, and the configuration file comprises a manifest list used for storing the unique identifier of the extension module in the configuration file; if so, go to step S24; otherwise, step S26 is executed.
In this embodiment, when the second scripting language component accesses the first scripting language component based on the target extension module, the application program queries the manifest list through the ModuleManager to determine whether the unique identifier of the target extension module is stored in the manifest list. Namely: when the application program is started, the application program needs to query the list through the ModuleManager to judge whether the list stores the unique identifier of the target extension module, wherein the first script language component is registered in a native system;
optionally, before the application program queries the list, the embodiment of the present invention further includes the following steps:
the application reads the unique identification of the extension module on the manifest list in the configuration file through the first scripting language component.
Wherein the first scripting language component is registered with the native system. In addition, if the first script language component is installed in the android system, the first script language component can be exemplarily set as an android platform android.
Namely: in this embodiment, the application reads the target extension module in the extensible _ config. Then, the application program needs to determine, through the ModuleManager, whether the extension module read from the configuration file includes the target extension module.
In this embodiment, the type of the first script language for constructing the first script language component is not limited, and only needs to meet the requirements of the embodiment of the present invention, such as: the first script language is Java.
Optionally, the second scripting language component specifically includes: in the hybrid development mode, non-native components corresponding to functions implemented by a program in the native system for building pages.
In this embodiment, the unique identifier is not limited, and only needs to meet the requirement of the embodiment of the present invention, and optionally, the unique identifier includes a name of the extension module.
In this embodiment, the type of the first script language for constructing the first script language component is not limited, and only needs to meet the requirements of the embodiment of the present invention, such as: the first script language is Java.
Optionally, the second scripting language component specifically includes: in the hybrid development mode, non-native components corresponding to functions implemented by a program in the native system for building pages.
In this embodiment, the kind of the second scripting language for constructing the second scripting language component is not limited, and only needs to meet the requirements of the embodiment of the present invention, such as: the second scripting language is JavaScript.
S24: determining that the configuration file contains the target configuration module under the condition that the list is determined to store the unique identifier of the target extension module;
s25: and calling the first script language component through the target extension module based on the second script language component to perform corresponding service operation.
And under the condition that the configuration file comprises the target extension module, the application program calls the first script language component through the target extension module to perform corresponding business operation based on the second script language component.
Specifically, if the target extension module is a module for performing network access, the application program calls the native platform to perform network access through the target extension module based on the second scripting language component.
S26: in the case that it is determined that the unique identifier of the target extension module is not stored in the manifest list, the application does not perform any processing.
In this regard, not only can: the application generates the extension module via the module manager module, and because the module manager module includes common logical data for generating the extension module. Therefore, when the application program needs to generate different extension modules due to update iteration, the common logic data can be directly called without writing and repeatedly writing the common logic data, and the code fault tolerance is improved.
In addition, the application generates an extension module through the ModuleManager, namely: the generated extension module is packaged in the ModuleManager. After the application program uses the packaged extension module, the calling speed of the extension module in the second script language component for calling the native platform is reduced, and certainly, the page rendering speed is increased, so that a user can see a page more quickly, and the time cost of the user is saved. Moreover, flexible configuration and modification of the extension module by developers can be effectively improved through the encapsulation of the extension module, so that the codes of the extension module achieve high cohesion and low coupling.
Moreover, in this embodiment, the speed of determining whether the extension module in the configuration file includes the target extension module may also be increased by the unique identifier of the extension module.
Fig. 3 is a flowchart of a method for implementing a component extension function according to a third embodiment of the present invention. According to fig. 3, a third embodiment of the present invention provides a method for implementing a component extension function, which is applied to an application program developed based on a hybrid development mode, and the method includes:
s31: generating an extension module based on common logic data contained in a module management component Modulemanager;
in this embodiment, the module management module manager includes common logic data for configuring each extension module, and in this embodiment, the application program generates the extension module through the common logic data in the module manager, so as to package the generated extension module to the module management module manager. In this embodiment, the common logic data is logic code.
S32: initializing a software development kit to configure the extension module into a configuration file;
and the application program configures the extension module into a configuration file by initializing the development kit SDK. The configuration file may be configured manually, or of course, may be obtained from the server by the terminal loaded with the application, or may be further obtained dynamically from the server by the terminal loaded with the application through a dynamic framework for hot update.
In the present embodiment, the configuration file includes a layout file XML, and the layout file XML is exemplarily set as an extensible _ config.
S33: when a second scripting language component accesses a first scripting language component based on a target extension module, querying the list through the ModuleManager, and judging whether the unique identifier of the target extension module is stored in the list or not, wherein the first scripting language component is registered in a native system, and the configuration file comprises a list for storing the unique identifier of the extension module in the configuration file; if so, go to step S34; otherwise, step S37 is executed
In this embodiment, when the second scripting language component accesses the first scripting language component based on the target extension module, the application program queries the manifest list through the ModuleManager to determine whether the manifest list stores the unique identifier of the target extension module. Namely: when the application program is started, the application program needs to query the list through the ModuleManager to judge whether the list stores the unique identifier of the target extension module, wherein the first script language component is registered in a native system;
optionally, before the application program queries the list, the embodiment of the present invention further includes the following steps:
the application reads the unique identification of the extension module on the manifest list in the configuration file through the first scripting language component.
Wherein the first scripting language component is registered with the native system. In addition, if the first script language component is installed in the android system, the first script language component can be exemplarily set as an android platform android.
Namely: in this embodiment, the application reads the target extension module in the extensible _ config. Then, the application program needs to determine, through the ModuleManager, whether the extension module read from the configuration file includes the target extension module.
In this embodiment, the type of the first script language for constructing the first script language component is not limited, and only needs to meet the requirements of the embodiment of the present invention, such as: the first script language is Java.
Optionally, the second scripting language component specifically includes: in the hybrid development mode, non-native components corresponding to functions implemented by a program in the native system for building pages.
In this embodiment, the unique identifier is not limited, and only needs to meet the requirement of the embodiment of the present invention, and optionally, the unique identifier includes a name of the extension module.
In this embodiment, the type of the first script language for constructing the first script language component is not limited, and only needs to meet the requirements of the embodiment of the present invention, such as: the first script language is Java.
Optionally, the second scripting language component specifically includes: in the hybrid development mode, non-native components corresponding to functions implemented by a program in the native system for building pages.
In this embodiment, the kind of the second scripting language for constructing the second scripting language component is not limited, and only needs to meet the requirements of the embodiment of the present invention, such as: the second scripting language is JavaScript.
S34: determining that the configuration file contains the target configuration module under the condition that the list is determined to store the unique identifier of the target extension module;
s35: feeding back prompt information to the second script language component through the Modulemanager to determine that the first script language component is called through the target extension module to perform corresponding business operation based on the second script language component;
through the determination message, the application program can be helped to determine whether to call the first script language component through the target extension module based on the second script language component so as to perform corresponding business operation.
S36: based on the second script language component, calling the first script language component through the target extension module to perform corresponding business operation.
And under the condition that the configuration file comprises the target extension module, the application program calls the first script language component through the target extension module to perform corresponding business operation based on the second script language component.
Specifically, if the target extension module is a module for performing network access, the native platform is called by the target extension module to perform network access based on the second script language component by using a program.
S37: in the case that it is determined that the unique identifier of the target extension module is not stored in the manifest list, the application does not perform any processing.
In this regard, not only can: the application generates the extension module via the module manager module, and because the module manager module includes common logical data for generating the extension module. Therefore, when the application program needs to generate different extension modules due to update iteration, the common logic data can be directly called without writing and repeatedly writing the common logic data, and the code fault tolerance is improved.
In addition, the application generates an extension module through the ModuleManager, that is: the generated extension module is packaged in the ModuleManager. After the application program uses the packaged extension module, the calling speed of the extension module in the second script language component for calling the native platform is reduced, and certainly, the page rendering speed is increased, so that a user can see a page more quickly, and the time cost of the user is saved. Moreover, flexible configuration and modification of the extension module by developers can be effectively improved through the encapsulation of the extension module, so that the codes of the extension module achieve high cohesion and low coupling.
Moreover, in this embodiment, the speed of determining whether the extension module in the configuration file includes the target extension module may also be increased by the unique identifier of the extension module.
In order to better explain the implementation process of the method in this embodiment, the method in this embodiment is explained below with reference to a specific application example.
Fig. 4 is a flowchart of a method for implementing a component extension function according to a fourth embodiment of the present invention. According to fig. 4, a fourth embodiment of the present invention provides a method for implementing a component extension function, which is applied to an application program developed based on a hybrid development mode, and the method includes:
1. the application program manages the extension module through a module management module in the encapsulated component extension function. Namely: and generating an extension module through the common logic data contained in the Modulemanager. Specifically, the base class package of the extension module is sunk in the software development kit SDK of the JavaScript component through the JavaScript component, and the corresponding extension module can be generated in the application program as long as the SDK is integrated by the corresponding application program and the base class of the extension module in the SDK of the JavaScript component is realized.
2. When the application program is started, the application program initializes the SDK, namely: and configuring the JavaScript component into an extensible _ config.xml file through an extension module generated by a Modulemanager.
3. And the application program reads the extension module in the extensible _ config.
4. When the JavaScript component accesses the network through the encapsulated target extension module, the application program calls the ModuleAnanager to judge whether the target extension module exists in the current android platform, namely whether the target extension module exists in the extension module read from the extensible _ configuration.
In case it is determined that there is a case, step 5 is executed, otherwise, step 7 is executed.
5. And under the condition that the target extension module is determined to exist in the extension modules read from the extensible _ config.xml file by the android platform, determining to call the target extension module, and judging whether to feed back prompt information callback to the JavaScript component. And if the feedback is determined, the ModuleAnager feeds back prompt information callback to the JavaScript component, and executes the step 6, otherwise, executes the step 7.
6. After the JavaScript component receives the prompt message callback, the application program calls the native platform through the target extension module based on the JavaScript component to perform corresponding business operation, and specifically, the application program performs corresponding business operation on a JavaScript page.
7. ModuleManager did not perform any treatment, i.e.: the calling of the target extension module is ended.
In this embodiment, in order to satisfy the requirement that the ModuleManager feeds back the prompt information callback to the JavaScript component, in this embodiment, a feedback function is added to a corresponding target extension module, and fig. 5 is a schematic diagram of an extension module in an implementation method of a component extension function according to a fourth embodiment of the present invention, where the extension module implements a corresponding protocol, and a specific type of the extension module implementing the corresponding protocol is shown in fig. 5.
Fig. 6 is a schematic structural diagram of an apparatus for implementing an expansion function of a component according to a fifth embodiment of the present invention. According to fig. 6, a fifth embodiment of the present invention provides an apparatus for implementing a component extension function, which is included in an application program developed based on a hybrid development mode, the apparatus including:
a generating module 110, configured to generate an extension module based on common logical data included in a module management component ModuleManager; a configuration module 120 for initializing a software development kit to configure the extension module into a configuration file; a determining module 130, configured to determine, by the ModuleManager, whether the target extension module is configured in the configuration file when the second scripting language component accesses the first scripting language component based on the target extension module, where the first scripting language component is registered in a native system; a calling module 150, configured to, if it is determined that the target extension module is configured in the configuration file, call, through the target extension module, the first script language component to perform a corresponding service operation based on the second script language component.
Optionally, the configuration file includes a list for storing the unique identifier of the extension module in the configuration file; the determining module 130 is specifically configured to: inquiring the list through the ModuleManager, and judging whether the list stores the unique identifier of the target expansion module; and if so, determining that the destination extension module is configured in the configuration file.
Optionally, the unique identifier includes a name of the extension module.
Optionally, the apparatus further comprises: a prompt module 140, configured to, when it is determined that the target extension module is configured in the configuration file, feed back prompt information to the second scripting language component through the ModuleManager to determine that the first scripting language component is called by the target extension module to perform a corresponding service operation based on the second scripting language component.
A sixth embodiment of the present invention provides an electronic device, including a processor and a memory; the memory is used for storing computer instructions, and the processor is used for executing the computer instructions stored by the memory to realize the implementation method of the component expansion function.
The terms and implementation principles related to the electronic device in the sixth embodiment of the present invention may specifically refer to the implementation method of the component expansion function in the first to fourth embodiments of the present invention, and are not described herein again.
A seventh embodiment of the present invention provides a computer-readable storage medium storing one or more modules, which are executable by one or more processors to implement a method for implementing component extension functions as described above.
The terms and implementation principles related to a computer-readable storage medium in the seventh embodiment of the present invention may specifically refer to an implementation method of the component expansion function in the first to fourth embodiments of the present invention, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element identified by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method for realizing component extension function is applied to an application program developed based on a hybrid development mode, and the method comprises the following steps:
generating an extension module based on common logic data contained in a module management component Modulemanager;
initializing a software development kit to configure the extension module into a configuration file, the configuration file including a layout file;
when a second script language component accesses a first script language component based on a target extension module, judging whether the target extension module is configured in the configuration file or not through the ModuleManager, wherein the first script language component is registered in a native system;
and under the condition that the target extension module is configured in the configuration file, based on the second script language component, calling the first script language component through the target extension module to perform corresponding business operation.
2. The method according to claim 1, wherein the configuration file comprises a list of lists for storing unique identifiers of the extension modules in the configuration file;
the determining, by the ModuleManager, whether the target extension module is configured in the configuration file includes:
inquiring the list through the ModuleManager, and judging whether the list stores the unique identifier of the target expansion module;
and if so, determining that the target expansion module is configured in the configuration file.
3. The method of claim 2, wherein the unique identification comprises a name of the extension module.
4. The method according to any one of claims 1-3, wherein in case it is determined that the target extension module is configured in the configuration file, the method further comprises:
and feeding back prompt information to the second script language component through the Modulemanager to determine that the first script language component is called by the target extension module to perform corresponding business operation based on the second script language component.
5. An apparatus for implementing component extension function, included in an application program developed based on a hybrid development mode, the apparatus comprising:
the generating module is used for generating an extension module based on the common logic data contained in the module management component Modulemanager;
the configuration module is used for initializing a software development kit so as to configure the extension module into a configuration file, and the configuration file comprises a layout file;
the judging module is used for judging whether the target extension module is configured in the configuration file or not through the ModuleManager when the second script language component accesses the first script language component based on the target extension module, wherein the first script language component is registered in a native system;
and the calling module is used for calling the first script language component through the target extension module based on the second script language component to perform corresponding service operation under the condition that the target extension module is configured in the configuration file.
6. The apparatus according to claim 5, wherein the configuration file comprises a list for storing the unique identifier of the extension module in the configuration file;
the judgment module is specifically configured to: inquiring the list through the ModuleManager, and judging whether the list stores the unique identifier of the target expansion module; and if so, determining that the target expansion module is configured in the configuration file.
7. The apparatus of claim 6, wherein the unique identifier comprises a name of the expansion module.
8. The apparatus of any of claims 5-7, further comprising:
and the prompt module is used for feeding back prompt information to the second script language component through the Modulemanager under the condition that the target extension module is configured in the configuration file so as to determine that the first script language component is called by the target extension module to perform corresponding business operation based on the second script language component.
9. An electronic device comprising a processor and a memory;
the memory is used for storing computer instructions, and the processor is used for executing the computer instructions stored by the memory to realize the realization method of the component expansion function in any one of claims 1 to 4.
10. A computer-readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement a method of implementing a component extension function of any one of claims 1 to 4.
CN201810503377.7A 2018-05-23 2018-05-23 Method, device, equipment and storage medium for realizing component extension function Active CN108845800B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810503377.7A CN108845800B (en) 2018-05-23 2018-05-23 Method, device, equipment and storage medium for realizing component extension function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810503377.7A CN108845800B (en) 2018-05-23 2018-05-23 Method, device, equipment and storage medium for realizing component extension function

Publications (2)

Publication Number Publication Date
CN108845800A CN108845800A (en) 2018-11-20
CN108845800B true CN108845800B (en) 2022-05-31

Family

ID=64213297

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810503377.7A Active CN108845800B (en) 2018-05-23 2018-05-23 Method, device, equipment and storage medium for realizing component extension function

Country Status (1)

Country Link
CN (1) CN108845800B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522500B (en) * 2018-11-26 2021-03-09 深圳乐信软件技术有限公司 Webpage display method, device, terminal and storage medium
CN112363705B (en) * 2020-11-10 2023-07-28 中国平安人寿保险股份有限公司 System package generation method, device, computer equipment and storage medium
CN112748915B (en) * 2020-12-30 2022-10-25 浪潮通用软件有限公司 Stimusoft-based method and device for dynamically extending business function

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9170782B2 (en) * 2012-03-27 2015-10-27 Microsoft Technology Licensing, Llc Extensible mechanism for providing suggestions in a source code editor
CN106202096A (en) * 2015-05-05 2016-12-07 阿里巴巴集团控股有限公司 Customer terminal webpage rendering intent and device
CN107526579A (en) * 2016-06-22 2017-12-29 中兴通讯股份有限公司 A kind of application program page development management method and device
CN107391169A (en) * 2017-06-09 2017-11-24 口碑控股有限公司 The dynamic updating method and device of the Android page
CN108021614A (en) * 2017-08-18 2018-05-11 口碑(上海)信息技术有限公司 A kind of method and system for page dynamic load

Also Published As

Publication number Publication date
CN108845800A (en) 2018-11-20

Similar Documents

Publication Publication Date Title
CN108055248B (en) Dubbo framework-based remote calling method, server and storage medium
KR20180137554A (en) PATCH UPGRADE BASED FILE PROCESSING METHOD AND DEVICE, TERMINAL,
CN108845800B (en) Method, device, equipment and storage medium for realizing component extension function
CN103970563B (en) The method of dynamic load Android class
CN104731625A (en) Method, device and mobile terminal for loading plugin
US9681251B1 (en) Customization for preloaded applications
CN109240697B (en) Call processing method and device and storage medium
CN104750528A (en) Management method and device for components in Android program
CN108776592B (en) Page construction method, device, equipment and storage medium
JP7106001B2 (en) SUB-APPLICATION DEVELOPMENT METHOD, APPARATUS, COMPUTER DEVICE, AND COMPUTER PROGRAM
CN109669692B (en) Source code sharing method, server, computer readable storage medium and system
CN108089873A (en) A kind of method and terminal of application component immediate updating
CN108845810B (en) Method and device for dynamically updating application, electronic equipment and storage medium
CN111930382A (en) Application page access method, device and equipment
CN110308999B (en) Method for dynamically sharing dependency package between applications, storage medium and mobile terminal
CN108021445B (en) Memory optimization method, device and system and computer readable storage medium
CN110851151B (en) Method, device, terminal, server and storage medium for pre-installing application
CN108804120B (en) Page construction method, device, equipment and storage medium
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN108268261B (en) UI (user interface) customization method of intelligent terminal, storage medium and intelligent terminal
CN112214250A (en) Application program assembly loading method and device
CN106598662B (en) Android-based application loading method and device
CN106775879B (en) VR application installation-free method and system based on android system client
CN103917951B (en) Application invocation method, operating system and browser
CN114064176A (en) View interaction method and device, electronic equipment and computer readable medium

Legal Events

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