CN113037814A - Web container injection implementation method and device, computer equipment and storage medium - Google Patents

Web container injection implementation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113037814A
CN113037814A CN202110211502.9A CN202110211502A CN113037814A CN 113037814 A CN113037814 A CN 113037814A CN 202110211502 A CN202110211502 A CN 202110211502A CN 113037814 A CN113037814 A CN 113037814A
Authority
CN
China
Prior art keywords
preset
api module
injected
module file
preset link
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110211502.9A
Other languages
Chinese (zh)
Other versions
CN113037814B (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.)
Ping An E Wallet Electronic Commerce Co Ltd
Original Assignee
Ping An E Wallet Electronic Commerce 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 Ping An E Wallet Electronic Commerce Co Ltd filed Critical Ping An E Wallet Electronic Commerce Co Ltd
Priority to CN202110211502.9A priority Critical patent/CN113037814B/en
Publication of CN113037814A publication Critical patent/CN113037814A/en
Application granted granted Critical
Publication of CN113037814B publication Critical patent/CN113037814B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention discloses a method and a device for realizing Web container injection, computer equipment and a storage medium. The method belongs to the technical field of research and development frameworks, and comprises the following steps: receiving a preset starting instruction sent by a user; acquiring a preset link parameter according to a preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of a bridge layer; if the preset link parameter exists in a preset mapping table of the bridge layer, acquiring a preset link of the API module file to be injected corresponding to the preset link parameter; acquiring an API module file to be injected according to a preset link; and injecting the acquired API module file to be injected into a Web container corresponding to the preset link parameter for calling by HTML 5. According to the embodiment of the application, the bridge layer is arranged between the HTML5 and the Web container to inject the API module file to be injected into the Web container, so that the developing efficiency of the HTML5 can be improved, and the code coupling is reduced.

Description

Web container injection implementation method and device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of research and development frameworks, in particular to a method and a device for realizing Web container injection, computer equipment and a storage medium.
Background
In the process of developing the HTML5 application, different Web containers need to be docked, and Native methods provided by the different Web containers need to be packaged and coordinated, but different developers usually only pay attention to the packaging and coordination of the Native methods required by the modules in charge of the developers, so that the development of the HTML5 application is not only low in efficiency but also high in cost. Development efficiency can be improved to some extent by using a bridge file in the industry at present, but code coupling is severe and version release is too frequent.
Disclosure of Invention
The embodiment of the invention provides a method and a device for realizing Web container injection, computer equipment and a storage medium, and aims to solve the problems of low development efficiency and serious code coupling in the development of HTML5 in the prior art.
In a first aspect, an embodiment of the present invention provides a method for implementing Web container injection, where the method includes:
receiving a preset starting instruction sent by a user;
acquiring a preset link parameter according to the preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of a bridge layer;
if the preset link parameter exists in a preset mapping table of the bridge layer, acquiring a preset link of an API module file to be injected corresponding to the preset link parameter;
acquiring the API module file to be injected according to the preset link;
and injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter.
In a second aspect, an embodiment of the present invention further provides an apparatus for implementing Web container injection, where the apparatus includes:
the receiving unit is used for receiving a preset starting instruction sent by a user;
the judging unit is used for acquiring a preset link parameter according to the preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of the bridge layer;
a first obtaining unit, configured to obtain a preset link to be injected into an API module file corresponding to the preset link parameter if the preset link parameter exists in a preset mapping table of the bridge layer;
the second obtaining unit is used for obtaining the API module file to be injected according to the preset link;
and the first injection unit is used for injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the above method when executing the computer program.
In a fourth aspect, the present invention also provides a computer-readable storage medium, which stores a computer program, and the computer program can implement the above method when being executed by a processor.
The embodiment of the invention provides a method and a device for realizing Web container injection, computer equipment and a storage medium. Wherein the method comprises the following steps: receiving a preset starting instruction sent by a user; acquiring a preset link parameter according to the preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of a bridge layer; if the preset link parameter exists in a preset mapping table of the bridge layer, acquiring a preset link of an API module file to be injected corresponding to the preset link parameter; acquiring the API module file to be injected according to the preset link; and injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter. According to the technical scheme of the embodiment of the invention, the bridge layer is arranged between the HTML5 and the Web container to inject the API module file to be injected into the Web container, so that the developing efficiency of the HTML5 can be improved, and the code coupling is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of an implementation method for Web container injection according to an embodiment of the present invention;
fig. 2 is a schematic sub-flow diagram of an implementation method for Web container injection according to an embodiment of the present invention;
fig. 3 is a schematic sub-flow diagram of an implementation method for Web container injection according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a method for implementing Web container injection according to another embodiment of the present invention;
fig. 5 is a schematic block diagram of an apparatus for implementing Web container injection according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of a first obtaining unit of an implementation apparatus for Web container injection according to an embodiment of the present invention;
fig. 7 is a schematic block diagram of a first obtaining subunit of an apparatus for implementing Web container injection according to an embodiment of the present invention;
fig. 8 is a schematic block diagram of a second obtaining unit of the apparatus for implementing Web container injection according to the embodiment of the present invention;
fig. 9 is a schematic block diagram of a second determining subunit of the apparatus for implementing Web container injection according to the embodiment of the present invention;
fig. 10 is a schematic block diagram of an apparatus for implementing Web container injection according to another embodiment of the present invention; and
fig. 11 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Referring to fig. 1, fig. 1 is a schematic flowchart of a method for implementing Web container injection according to an embodiment of the present invention. The implementation method of Web container injection in the embodiment of the invention can be applied to terminals, such as intelligent terminal equipment of a portable computer, a notebook computer, a desktop computer and the like, and the implementation method of Web container injection is implemented through application programs installed on the terminals, so that the development efficiency is improved, and the code coupling is reduced. As shown in fig. 1, the method comprises the following steps S100-S150.
And S100, receiving a preset starting instruction sent by a user.
In the embodiment of the present invention, if a preset start instruction sent by a user is received, for example, the user clicks an HTML5 page, so that sending of the preset start instruction can be implemented. HTML5 is the fifth edition of hypertext markup language.
S110, acquiring a preset link parameter according to the preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of a bridge layer, if the preset link parameter exists in the preset mapping table of the bridge layer, executing the step S120, otherwise, executing the step S150.
In the embodiment of the invention, if a preset starting instruction is received, a preset link parameter is obtained according to the preset starting instruction, and whether the preset link parameter exists in a preset mapping table of a bridge layer or not is judged. The preset mapping table is a table of storage elements according to key/value pairs. The preset mapping table stores keys, which can be any type of object, along with values, where there cannot be duplicate keys, and values are overwritten if the stored keys already exist in the mapping table. The preset link parameter is a key in a preset mapping table.
In the embodiment of the present invention, Native methods in different Web containers are uniformly packaged into a Native method, and the uniformly packaged Native method is referred to as an HL _ WEBVIEW API, which is a bridge layer. Different Web containers can be called by the HTML5 end through the bridge layer, and the bridge layer can be flexibly expanded, namely the HL _ WEBVIEW API can expand the Native method of the API; the Native method in the HL _ WEBVIEW API can be modified, and the modified Native method is released by adding a version suffix.
And S120, acquiring a preset link of the API module file to be injected corresponding to the preset link parameter.
In the embodiment of the present invention, if the preset link parameter exists in the preset mapping table of the bridge layer, the preset link of the API module file to be injected corresponding to the preset link parameter is obtained. The preset link is a CDN link. CDN (content delivery network) is a distributed content distribution network constructed on a data network, and in the embodiment of the present invention, the API module file to be injected may be obtained through a CDN link.
Referring to fig. 2, in an embodiment, for example, in the embodiment of the present invention, the step S120 includes the following steps S121 to S124.
S121, judging whether preset API module files corresponding to the preset link parameters exist in preset API module files or not through configuration parameters in the preset mapping table;
s122, if the preset API module file corresponding to the preset link parameter exists in the preset preposed API module file, determining the preset API module file and the preset preposed API module file as API module files to be injected;
s123, if the preset API module file corresponding to the preset link parameter does not have the preset preposed API module file, determining the preset API module file as the API module file to be injected;
and S124, acquiring the preset link of the API module file to be injected.
In the embodiment of the present invention, if the preset link parameter exists in the preset mapping table of the bridge layer, it is determined whether a preset API module file corresponding to the preset link parameter exists in a preset pre-API module file according to a configuration parameter in the preset mapping table; if the preset API module file corresponding to the preset link parameter exists in the preset preposed API module file, which indicates that the preset API module file exists in a dependent API module file, the preset preposed API module file is required to be acquired before the preset API module file is acquired, so that the preset API module file operates normally, and therefore the preset API module file and the preset preposed API module file are taken as the API module file to be injected together; if the preset API module file corresponding to the preset link parameter does not have the preset preposed API module file, the preset API module file does not have a dependent API module file, and the preset API module file does not need to be acquired, the preset API module file is directly used as the API module file to be injected. And acquiring a preset link corresponding to the API module file after determining the API module file to be injected.
And S130, acquiring the API module file to be injected according to the preset link.
In the embodiment of the present invention, after the preset link of the API module file to be injected corresponding to the preset link parameter is acquired, the API module file to be injected is acquired according to the preset link website, so as to inject the API module file to be injected into the Web container corresponding to the preset link parameter.
Referring to fig. 3, in an embodiment, for example, in the embodiment of the present invention, the step S130 includes the following steps S131 to S133.
S131, judging whether the API module file to be injected exists in a cache or not by adopting a preset cache mechanism according to the preset link;
s132, if the API module file to be injected does not exist in the cache, acquiring the API module file to be injected through the preset link;
s133, if the API module file to be injected exists in the cache, the API module file to be injected is obtained in the cache.
In the embodiment of the present invention, the API module file to be injected is obtained according to the preset link, specifically, whether the API module file to be injected exists in a cache is determined by using a preset cache mechanism according to the preset link, and if the API module file to be injected does not exist in the cache, which indicates that the API module file to be injected needs to be downloaded, the API module file to be injected is obtained through the preset link; and if the API module file to be injected exists in the cache, acquiring the API module file to be injected in the cache. The preset Caching mechanism is Browser Caching, Browser Caching (Browser Caching) is to save resources of a network and accelerate browsing, the Browser stores a recently requested document on a user disk, and when a visitor requests the page again, the Browser can display the document from a local disk, so that browsing of the page can be accelerated.
And S140, injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter.
In the embodiment of the present invention, after the API module file to be injected is acquired according to the preset link, the acquired API module file to be injected is injected into the Web container corresponding to the preset link parameter. In the embodiment of the invention, different API module files to be injected required by HTML5 running are obtained through the bridge layer, and the obtained API module files to be injected are injected into the Web container, so that the developing efficiency of HTML5 can be improved, and the code coupling is reduced.
And S150, directly injecting the API module file to be injected corresponding to the preset link parameter into the Web container.
In the embodiment of the invention, if the preset link parameter does not exist in the preset mapping table of the bridge layer, which indicates that the Native method corresponding to the preset link parameter is not encapsulated in the bridge layer, the API module file to be injected is directly injected into the Web container.
Fig. 4 is a flowchart illustrating a method for implementing Web container injection according to another embodiment of the present invention, as shown in fig. 4, in this embodiment, the method includes steps S100 to S160. That is, in the present embodiment, the method further includes step S160 after step S150 of the above embodiment.
And S160, if the HTML5 calls the API module file to be injected in the Web container fails, sending preset failure prompt information to the HTML5 through the bridge layer.
In the embodiment of the present invention, after the API module file to be injected is injected into the Web container corresponding to the preset link parameter for HTML5 to call, if HTML5 fails to call the API module file to be injected in the Web container, a preset failure prompt message is sent to HTML5 through the bridge layer. The preset failure prompt message is a preset error code to remind an HTML5 developer to perform corresponding processing. Understandably, if the file of the API module to be injected does not exist, preset failure prompt information is sent.
It should be noted that, in the embodiment of the present invention, clicking the HTML5 application icon by the user triggers loading of the API module file and injecting the API module file into the Web container, for example, if the HTML5 application is an application with a taxi taking function, the HTML5 is triggered to load the location API, and the location API is injected into the Web container for the HTML5 to call.
Fig. 5 is a schematic block diagram of an apparatus 200 for implementing Web container injection according to an embodiment of the present invention. As shown in fig. 5, the present invention further provides an implementation apparatus 200 for Web container injection, corresponding to the implementation method for Web container injection. The implementation apparatus 200 for Web container injection includes a unit for executing the implementation method for Web container injection described above, and the apparatus may be configured in a terminal. Specifically, referring to fig. 5, the implementation apparatus 200 for Web container injection includes a receiving unit 201, a determining unit 202, a first obtaining unit 203, a second obtaining unit 204, a first injecting unit 205, and a second injecting unit 206.
The receiving unit 201 is configured to receive a preset starting instruction sent by a user; the determining unit 202 is configured to obtain a preset link parameter according to the preset starting instruction and determine whether the preset link parameter exists in a preset mapping table of a bridge layer; the first obtaining unit 203 is configured to obtain a preset link of an API module file to be injected, where the preset link parameter is in a preset mapping table of the bridge layer, and the preset link parameter corresponds to the preset link parameter; the second obtaining unit 204 is configured to obtain the API module file to be injected according to the preset link; the first injection unit 205 is configured to inject the acquired API module file to be injected into a Web container corresponding to the preset link parameter; the second injection unit 206 is configured to directly inject the API module file to be injected corresponding to the preset link parameter into the Web container if the preset link parameter does not exist in the preset mapping table of the bridge layer.
In some embodiments, for example, in this embodiment, as shown in fig. 6, the first acquiring unit 203 includes a first determining subunit 2031, a first determining unit 2032, a second determining unit 2033, and a first acquiring subunit 2034.
The first determining subunit 2031 is configured to determine, according to the configuration parameter in the preset mapping table, whether a preset API module file corresponding to the preset link parameter exists in a preset pre-API module file; the first determining unit 2032 is configured to determine, if the preset API module file corresponding to the preset link parameter exists in the preset pre-API module file, the preset API module file and the preset pre-API module file as API module files to be injected; the second determining unit 2033 is configured to determine, if the preset API module file corresponding to the preset link parameter does not have the preset pre-API module file, a preset API module file as the API module file to be injected; the first obtaining subunit 2034 is configured to obtain a preset link of the API module file to be injected.
In some embodiments, such as this embodiment, the first acquisition sub-unit 2034 comprises a second acquisition sub-unit 20341, as shown in fig. 7.
The second obtaining subunit 20341 is configured to obtain a CDN link of the API module file to be injected.
In some embodiments, for example, in the present embodiment, as shown in fig. 8, the second obtaining unit 204 includes a second determining subunit 2041, a third obtaining subunit 2042, and a fourth obtaining subunit 2043.
The second judging subunit 2041 is configured to judge, according to the preset link, whether the API module file to be injected exists in a cache by using a preset cache mechanism; the third obtaining subunit 2042 is configured to, if the API module file to be injected does not exist in the cache, obtain the API module file to be injected through the preset link; the fourth obtaining subunit 2043 is configured to obtain the API module file to be injected from the cache if the API module file to be injected exists in the cache.
In some embodiments, for example, in the present embodiment, as shown in fig. 9, the second determining subunit 2041 includes a third determining subunit 20411.
The third determining subunit 20411 is configured to determine, according to the preset link, whether the API module file to be injected exists in the cache by using a browser caching mechanism.
In some embodiments, such as this embodiment, as shown in fig. 10, the apparatus 200 further includes a prompting unit 207.
The prompt unit 207 is configured to send a preset failure prompt message to the HTML5 through the bridge layer if the HTML5 fails to call the API module file to be injected in the Web container.
Referring to fig. 11, fig. 11 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 300 is a terminal, and the terminal may be an electronic device with a communication function, such as a tablet computer, a notebook computer, and a desktop computer.
Referring to fig. 11, the computer device 300 includes a processor 302, memory, and a network interface 305 connected by a system bus 301, wherein the memory may include a non-volatile storage medium 303 and an internal memory 304.
The nonvolatile storage medium 303 may store an operating system 3031 and a computer program 3032. The computer program 3032, when executed, causes the processor 302 to perform a method for implementing Web container injection.
The processor 302 is used to provide computing and control capabilities to support the operation of the overall computer device 300.
The internal memory 304 provides an environment for running a computer program 3032 in the non-volatile storage medium 303, and the computer program 3032, when executed by the processor 302, causes the processor 302 to execute a method for implementing the Web container injection.
The network interface 305 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 11 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation of the computer apparatus 300 to which the present application is applied, and that a particular computer apparatus 300 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components. Wherein the processor 302 is configured to run a computer program 3032 stored in the memory to implement the following steps: receiving a preset starting instruction sent by a user; acquiring a preset link parameter according to the preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of a bridge layer; if the preset link parameter does not exist in a preset mapping table of the bridge layer, directly injecting an API module file to be injected corresponding to the preset link parameter into the Web container; if the preset link parameter exists in a preset mapping table of the bridge layer, acquiring a preset link of an API module file to be injected corresponding to the preset link parameter; acquiring the API module file to be injected according to the preset link; and injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter.
In some embodiments, for example, in this embodiment, when the processor 302 implements the preset link step of acquiring the API module file to be injected corresponding to the preset link parameter, the following steps are specifically implemented: judging whether preset API module files corresponding to the preset link parameters exist in preset API module files or not according to configuration parameters in the preset mapping table; if the preset API module file corresponding to the preset link parameter exists in the preset preposed API module file, determining the preset API module file and the preset preposed API module file as API module files to be injected; if the preset API module file corresponding to the preset link parameter does not have the preset preposed API module file, determining the preset API module file as the API module file to be injected; and acquiring a preset link of the API module file to be injected.
In some embodiments, for example, in this embodiment, when the processor 302 implements the step of obtaining the preset link of the API module file to be injected, the following steps are specifically implemented: and obtaining the CDN link of the API module file to be injected.
In some embodiments, for example, in this embodiment, when the processor 302 implements the step of obtaining the API module file to be injected according to the preset link, the following steps are specifically implemented: judging whether the API module file to be injected exists in a cache or not by adopting a preset cache mechanism according to the preset link; if the API module file to be injected does not exist in the cache, acquiring the API module file to be injected through the preset link; and if the API module file to be injected exists in the cache, acquiring the API module file to be injected in the cache.
In some embodiments, for example, in this embodiment, when the processor 302 performs the step of determining whether the file to be injected into the API module has a cache by using a preset cache mechanism according to the preset link, the following steps are specifically performed: and judging whether the file to be injected into the API module is cached or not by adopting a browser caching mechanism according to the preset link.
In some embodiments, for example, in this embodiment, after the step of injecting the obtained API module file to be injected into the Web container corresponding to the preset link parameter is implemented by the processor 302, the implementation further includes the following steps: if the HTML5 calls the API module file to be injected in the Web container to fail, sending preset failure prompt information to the HTML5 through the bridge layer.
It should be understood that, in the embodiment of the present Application, the Processor 302 may be a Central Processing Unit (CPU), and the Processor 302 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above. Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. The computer program, when executed by a processor, causes the processor to perform the steps of: receiving a preset starting instruction sent by a user; acquiring a preset link parameter according to the preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of a bridge layer; if the preset link parameter does not exist in a preset mapping table of the bridge layer, directly injecting an API module file to be injected corresponding to the preset link parameter into the Web container; if the preset link parameter exists in a preset mapping table of the bridge layer, acquiring a preset link of an API module file to be injected corresponding to the preset link parameter; acquiring the API module file to be injected according to the preset link; and injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter.
In some embodiments, for example, in this embodiment, when the processor executes the computer program to implement the preset link step of acquiring the API module file to be injected corresponding to the preset link parameter, the following steps are specifically implemented: judging whether preset API module files corresponding to the preset link parameters exist in preset API module files or not according to configuration parameters in the preset mapping table; if the preset API module file corresponding to the preset link parameter exists in the preset preposed API module file, determining the preset API module file and the preset preposed API module file as API module files to be injected; if the preset API module file corresponding to the preset link parameter does not have the preset preposed API module file, determining the preset API module file as the API module file to be injected; and acquiring a preset link of the API module file to be injected.
In some embodiments, for example, in this embodiment, when the processor executes the computer program to implement the step of obtaining the preset link of the API module file to be injected, the following steps are specifically implemented: and obtaining the CDN link of the API module file to be injected.
In some embodiments, for example, in this embodiment, when the processor executes the computer program to implement the step of obtaining the API module file to be injected according to the preset link, the following steps are specifically implemented: judging whether the API module file to be injected exists in a cache or not by adopting a preset cache mechanism according to the preset link; if the API module file to be injected does not exist in the cache, acquiring the API module file to be injected through the preset link; and if the API module file to be injected exists in the cache, acquiring the API module file to be injected in the cache.
In some embodiments, for example, in this embodiment, when the processor executes the computer program to implement the step of determining whether the file of the API module to be injected has a cache according to the preset link by using a preset cache mechanism, the following steps are specifically implemented: and judging whether the file to be injected into the API module is cached or not by adopting a browser caching mechanism according to the preset link.
In some embodiments, for example, in this embodiment, after the step of implementing, by the processor, the injection of the obtained to-be-injected API module file into the Web container corresponding to the preset link parameter is implemented by executing the computer program, the specific implementation further includes the following steps: if the HTML5 calls the API module file to be injected in the Web container to fail, sending preset failure prompt information to the HTML5 through the bridge layer.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, while the invention has been described with respect to the above-described embodiments, it will be understood that the invention is not limited thereto but may be embodied with various modifications and changes.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method for implementing Web container injection is characterized by comprising the following steps:
receiving a preset starting instruction sent by a user;
acquiring a preset link parameter according to the preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of a bridge layer;
if the preset link parameter exists in a preset mapping table of the bridge layer, acquiring a preset link of an API module file to be injected corresponding to the preset link parameter;
acquiring the API module file to be injected according to the preset link;
and injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter.
2. The method according to claim 1, wherein after determining whether the predetermined link parameter exists in a predetermined mapping table of a bridge layer, the method further comprises:
and if the preset link parameter does not exist in the preset mapping table of the bridge layer, directly injecting the API module file to be injected corresponding to the preset link parameter into the Web container.
3. The method according to claim 1, wherein the obtaining the preset link of the API module file to be injected corresponding to the preset link parameter comprises:
judging whether preset API module files corresponding to the preset link parameters exist in preset API module files or not according to configuration parameters in the preset mapping table;
if the preset API module file corresponding to the preset link parameter exists in the preset preposed API module file, determining the preset API module file and the preset preposed API module file as API module files to be injected;
if the preset API module file corresponding to the preset link parameter does not have the preset preposed API module file, determining the preset API module file as the API module file to be injected;
and acquiring a preset link of the API module file to be injected.
4. The method according to claim 3, wherein the obtaining the preset link of the API module file comprises:
and obtaining the CDN link of the API module file to be injected.
5. The method according to claim 1, wherein the obtaining the API module file to be injected according to the preset link includes:
judging whether the API module file to be injected exists in a cache or not by adopting a preset cache mechanism according to the preset link;
if the API module file to be injected does not exist in the cache, acquiring the API module file to be injected through the preset link;
and if the API module file to be injected exists in the cache, acquiring the API module file to be injected in the cache.
6. The method according to claim 5, wherein the determining whether the API module file to be injected exists in the cache by using a preset cache mechanism according to the preset link comprises:
and judging whether the file to be injected into the API module is cached or not by adopting a browser caching mechanism according to the preset link.
7. The method according to claim 1, wherein after the step of injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter, the method further comprises:
if the HTML5 calls the API module file to be injected in the Web container to fail, sending preset failure prompt information to the HTML5 through the bridge layer.
8. An implementation apparatus for Web container injection, comprising:
the receiving unit is used for receiving a preset starting instruction sent by a user;
the judging unit is used for acquiring a preset link parameter according to the preset starting instruction and judging whether the preset link parameter exists in a preset mapping table of the bridge layer;
a first obtaining unit, configured to obtain a preset link to be injected into an API module file corresponding to the preset link parameter if the preset link parameter exists in a preset mapping table of the bridge layer;
the second obtaining unit is used for obtaining the API module file to be injected according to the preset link;
and the first injection unit is used for injecting the acquired API module file to be injected into the Web container corresponding to the preset link parameter.
9. A computer arrangement, characterized in that the computer arrangement comprises a memory having stored thereon a computer program and a processor implementing the method according to any of claims 1-7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method according to any one of claims 1-7.
CN202110211502.9A 2021-02-25 2021-02-25 Web container injection implementation method and device, computer equipment and storage medium Active CN113037814B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110211502.9A CN113037814B (en) 2021-02-25 2021-02-25 Web container injection implementation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110211502.9A CN113037814B (en) 2021-02-25 2021-02-25 Web container injection implementation method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113037814A true CN113037814A (en) 2021-06-25
CN113037814B CN113037814B (en) 2022-11-25

Family

ID=76462008

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110211502.9A Active CN113037814B (en) 2021-02-25 2021-02-25 Web container injection implementation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113037814B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040064830A1 (en) * 2002-09-30 2004-04-01 Irving Richard H. Runtime services for network software platform
CN109254793A (en) * 2018-09-20 2019-01-22 Oppo广东移动通信有限公司 Engine partition method, relevant device and computer readable storage medium
CN109800367A (en) * 2018-12-13 2019-05-24 平安科技(深圳)有限公司 Webpage loading method, device, computer equipment and storage medium
CN109815115A (en) * 2018-12-14 2019-05-28 深圳壹账通智能科技有限公司 Method and device, the computer equipment, storage medium of debugging bridge joint mouth
CN109857515A (en) * 2018-12-20 2019-06-07 深圳前海微众银行股份有限公司 Bridge communications method, apparatus, equipment and computer readable storage medium
CN110543372A (en) * 2019-09-10 2019-12-06 北京百度网讯科技有限公司 Method and device for interaction between mobile terminal native terminal and H5 terminal

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040064830A1 (en) * 2002-09-30 2004-04-01 Irving Richard H. Runtime services for network software platform
CN109254793A (en) * 2018-09-20 2019-01-22 Oppo广东移动通信有限公司 Engine partition method, relevant device and computer readable storage medium
CN109800367A (en) * 2018-12-13 2019-05-24 平安科技(深圳)有限公司 Webpage loading method, device, computer equipment and storage medium
CN109815115A (en) * 2018-12-14 2019-05-28 深圳壹账通智能科技有限公司 Method and device, the computer equipment, storage medium of debugging bridge joint mouth
CN109857515A (en) * 2018-12-20 2019-06-07 深圳前海微众银行股份有限公司 Bridge communications method, apparatus, equipment and computer readable storage medium
CN110543372A (en) * 2019-09-10 2019-12-06 北京百度网讯科技有限公司 Method and device for interaction between mobile terminal native terminal and H5 terminal

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
慕虎7371278: "框架之八 || API项目整体搭建 6.3 异步泛型仓储+依赖注入初探", 《手记》 *
混元霹雳手成昆: "JSBridge的原理", 《稀土掘金》 *

Also Published As

Publication number Publication date
CN113037814B (en) 2022-11-25

Similar Documents

Publication Publication Date Title
WO2019242166A1 (en) Application update method and system, and computer device and storage medium
US7596610B2 (en) Method and system for installing applications via a display page
JP4565032B2 (en) Method, system, and computer program for installing software on a mobile computing device using Configuration Manager security features
CN107832099B (en) Method and device for client version compatibility and storage medium
US8458585B1 (en) Delayed code parsing for reduced startup latency
CN109271213B (en) HTML5 page loading method and device, computer equipment and storage medium
US8346889B1 (en) Event-driven module loading
CN109743359B (en) Hybrid communication processing method and device, computer equipment and storage medium
CN111104448A (en) Method and device for exporting large-data-volume Excel file, computer equipment and storage medium
US9178746B2 (en) Browser-based fetch of external libraries
CN111427596B (en) Software upgrading method and device and terminal equipment
WO2019149150A1 (en) Application processing method and device, and computer storage medium
US20050149952A1 (en) Persisting state across navigations in a navigation-based application and responding to navigation-related events throughout an application
WO2015067189A1 (en) Method and apparatus for installing application
CN111444453A (en) Page return data processing method and device
CN113037814B (en) Web container injection implementation method and device, computer equipment and storage medium
CN111857701A (en) Terminal dynamic interface display method and device, computer equipment and storage medium
US10628513B2 (en) Providing isolated extensibility for webpages with a unified manifest and omni-accessible platform script
CN111090442A (en) Application updating method and device and storage medium
US7552451B2 (en) Persisting state across navigations in a navigation-based application and responding to navigation-related events throughout an application
US20240031166A1 (en) Web-side data signature method and apparatus and computer device
CN113220296B (en) Android system interaction method and device
CN113282363A (en) Method and device for optimizing hybrid APP
CN111416863A (en) Diversified download management method, terminal and medium based on client
CN113626228A (en) Method, device and equipment for repairing fault webpage and storage 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