CN118276972A - Three-party package loading method, device, equipment and storage medium - Google Patents
Three-party package loading method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN118276972A CN118276972A CN202410371289.1A CN202410371289A CN118276972A CN 118276972 A CN118276972 A CN 118276972A CN 202410371289 A CN202410371289 A CN 202410371289A CN 118276972 A CN118276972 A CN 118276972A
- Authority
- CN
- China
- Prior art keywords
- loading
- javascript
- packet
- preset
- package
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000011068 loading method Methods 0.000 title claims abstract description 241
- 238000012795 verification Methods 0.000 claims abstract description 56
- 238000000034 method Methods 0.000 claims abstract description 50
- 230000008569 process Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 14
- 230000003993 interaction Effects 0.000 claims description 9
- 238000011161 development Methods 0.000 abstract description 4
- 238000012856 packing Methods 0.000 abstract description 2
- 238000004891 communication Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The application discloses a method, a device, equipment and a storage medium for loading a three-party package, which relate to the technical field of project development and are applied to clients and comprise the following steps: acquiring loading parameters for a JavaScript packet; verifying the loading parameters through a preset verifier to obtain a corresponding verification result; if the verification result represents that the verification of the loading parameters is successful, judging whether a target JavaScript packet matched with the loading parameters exists in a preset cache space; the preset cache space is used for caching the JavaScript packets loaded by the history; if yes, loading a target JavaScript packet from the preset cache space; if the target JavaScript packet does not exist, loading the target JavaScript packet matched with the loading parameters from the server. Therefore, the method and the device can avoid repeatedly loading the three-party package through the buffer space, improve the loading efficiency and avoid the problem of overlarge volume caused by packing the three-party package into the project.
Description
Technical Field
The present invention relates to the field of project development technologies, and in particular, to a method, an apparatus, a device, and a storage medium for loading a three-way package.
Background
In current Web development, various JavaScript (a programming language) packages are often required to provide different functions. These packages may be developed by different developers or organizations and distributed with npm (Node PACKAGE MANAGER, a package administration and distribution tool), yarn (Yet Another Resource Negotiator, another resource coordinator), etc. package administration tools. However, in the current three-party package loading technology, generally, all packages are imported once when the package is loaded, and the package function is not used by the user, so that performance waste is caused, and meanwhile, the whole package becomes huge, and the pressure of a server is increased. And when the user side loads through the browser, the page loading speed is low and the flow is used too much because of the huge project.
It can be seen that how to more conveniently implement JavaScript three-party package loading is a problem to be solved in the art.
Disclosure of Invention
Accordingly, the present invention aims to provide a method, apparatus, device and storage medium for loading a three-way package, which can avoid repeatedly loading the three-way package through a buffer space, thereby improving loading efficiency and avoiding the problem of overlarge volume caused by packing the three-way package into a project. The specific scheme is as follows:
in a first aspect, the present application provides a method for loading a three-way package, which is applied to a client, and includes:
Acquiring loading parameters for a JavaScript packet;
Verifying the loading parameters through a preset verifier to obtain a corresponding verification result;
If the verification result represents that the verification of the loading parameter is successful, judging whether a target JavaScript packet matched with the loading parameter exists in a preset cache space; the preset cache space is used for caching the JavaScript packets loaded by the history;
if the target JavaScript packet exists in the preset cache space, loading the target JavaScript packet from the preset cache space;
and if the target JavaScript packet does not exist in the preset cache space, loading the target JavaScript packet matched with the loading parameter from a server.
Optionally, the obtaining the loading parameters for the JavaScript packet includes:
The loading parameters for the JavaScript package are invoked in the code of the current project.
Optionally, the verifying the loading parameter by a preset verifier to obtain a corresponding verification result includes:
checking the parameter format of the loading parameter through a preset checker to obtain a first checking result;
And verifying the loading parameters through a custom verification rule in the preset verifier to obtain a second verification result.
Optionally, the loading the target JavaScript packet matched with the loading parameter from the server includes:
loading a target JavaScript packet matched with the loading parameter from a server by adding a script tag, and judging whether the loading is completed within preset loading time;
If not, loading the target JavaScript packet matched with the loading parameter from the server by adding the script tag again;
If yes, generating first prompt information for representing that loading of the target JavaScript packet is completed.
Optionally, the method further comprises:
If the verification result represents that the verification of the loading parameter is unsuccessful, generating second prompt information based on the loading parameter;
And displaying the first prompt information and the second prompt information through a preset man-machine interaction interface so as to facilitate relevant staff to process the loading process of the JavaScript packet.
Optionally, after the target JavaScript packet matched with the loading parameter is loaded from the server, the method further includes:
and caching the target JavaScript packet to the preset cache space hung under the global variable to update the JavaScript packet in the preset cache space.
Optionally, the method further comprises:
And acquiring a position configuration instruction aiming at the preset cache space through a preset man-machine interaction interface so as to configure the position of the preset cache space based on the position configuration instruction.
In a second aspect, the present application provides a three-party package loading device, applied to a client, including:
the loading parameter acquisition module is used for acquiring loading parameters aiming at the JavaScript packet;
the loading parameter verification module is used for verifying the loading parameters through a preset verifier to obtain corresponding verification results;
The three-party packet judging module is used for judging whether a target JavaScript packet matched with the loading parameter exists in a preset cache space or not when the verification result represents that the loading parameter is successfully verified; the preset cache space is used for caching the JavaScript packets loaded by the history;
The first three-party package loading module is used for loading the target JavaScript package from the preset buffer space when the target JavaScript package exists in the preset buffer space;
And the second-party package loading module is used for loading the target JavaScript package matched with the loading parameter from the server when the target JavaScript package does not exist in the preset cache space.
In a third aspect, the present application provides an electronic device, comprising:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the three-party package loading method.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which when executed by a processor implements a three-way package loading method as described above.
Therefore, the method and the device firstly acquire the loading parameters aiming at the JavaScript packet; then, verifying the loading parameters through a preset verifier to obtain a corresponding verification result; if the verification result represents that the verification of the loading parameter is successful, judging whether a target JavaScript packet matched with the loading parameter exists in a preset cache space; the preset cache space is used for caching the JavaScript packets loaded by the history; if the target JavaScript packet exists in the preset cache space, loading the target JavaScript packet from the preset cache space; and if the target JavaScript packet does not exist in the preset cache space, loading the target JavaScript packet matched with the loading parameter from a server. Therefore, the application can cache the historically loaded JavaScript packet through the preset cache space, and the subsequent same JavaScript packet does not need to be loaded from a remote server side and can be loaded from the cache space in real time; therefore, the problem that the project volume is overlarge because the traditional package manager packages the JavaScript package into the project is avoided, the JavaScript package can be used for multiple times after being loaded once, the additional loading time is shortened, and the loading efficiency of the JavaScript package is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for loading a three-party package;
FIG. 2 is a flow chart of a specific inspection method disclosed in the present application;
FIG. 3 is a flowchart of a specific three-party package loading method disclosed in the present application;
FIG. 4 is a flowchart of another specific method for loading a three-party package according to the present disclosure;
FIG. 5 is a schematic diagram of a three-party package loading device according to the present disclosure;
Fig. 6 is a block diagram of an electronic device according to the present disclosure.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, the embodiment of the invention discloses a three-party package loading method, which is applied to a client and comprises the following steps:
And S11, acquiring loading parameters for the JavaScript packet.
In the application, when a JavaScript three-party package is loaded in the project development process of a client, loading parameters aiming at the JavaScript package are firstly obtained; in a specific embodiment, the obtaining the loading parameters for the JavaScript packet may include: the loading parameters for the JavaScript package are invoked in the code of the current project. Specifically, related parameters of the JavaScript three-party package to be loaded are added into the project code by related staff, and corresponding loading parameters can be obtained through aiming at the JavaScript package code in the project.
And step S12, checking the loading parameters through a preset checker to obtain a corresponding checking result.
In the application, after the loading parameters aiming at the JavaScript packet are obtained, the loading parameters can be checked, and the checking process aiming at the loading parameters is carried out through the preset checker, so that the corresponding checking result is obtained. In a specific embodiment, the verifying, by using a preset verifier, the loading parameter to obtain a corresponding verification result may include: checking the parameter format of the loading parameter through a preset checker to obtain a first checking result; and verifying the loading parameters through a custom verification rule in the preset verifier to obtain a second verification result. Specifically, the preset verifier may include a conventional verification rule for loading parameters and a verification rule customized by staff; thus, a corresponding first check result and second check result can be obtained. It will be appreciated that conventional verification of loading parameters may include verification of format, type, and specification. Further, when the first verification result and the second verification result both represent that the verification of the loading parameter is successful, the loading parameter is determined to be legal; otherwise, the loading parameter can be judged to be illegal, and the loading parameter is stored in a preset error processing module.
In a specific embodiment, as shown in fig. 2, in the process of verifying the loading parameter, the loading parameter may be verified by a built-in parameter format, a built-in parameter type and a built-in parameter specification; and, the relevant staff can customize the check rule, check the parameter loaded to the three-party package. Further, if the verification is not passed, the loading parameter may be sent to an error handler to prompt the staff.
Step S13, if the verification result represents that the verification of the loading parameter is successful, judging whether a target JavaScript packet matched with the loading parameter exists in a preset cache space; the preset cache space is used for caching the JavaScript packets loaded by the history.
According to the method, the obtained loading parameters aiming at the JavaScript packet can be checked through the steps, and when the checking result represents that the loading parameters are checked successfully, whether the target JavaScript packet matched with the loading parameters exists in the middle of the preset cache can be further judged; it should be noted that the preset buffer space is used for storing the JavaScript packet loaded in history, and the JavaScript packet can be separated from the current item by using the preset buffer space, so that the JavaScript packet is prevented from being directly packed into the current item, and the volume of the item is not affected.
Step S14, if the target JavaScript packet exists in the preset cache space, loading the target JavaScript packet from the preset cache space.
Furthermore, if the target JavaScript packet corresponding to the loading parameter exists in the preset cache space, the target JavaScript packet can be loaded from the preset cache space and used directly. In a specific embodiment, the method may further include: and acquiring a position configuration instruction aiming at the preset cache space through a preset man-machine interaction interface so as to configure the position of the preset cache space based on the position configuration instruction. Specifically, the preset cache space can be adjusted or configured to be at the position according to the position configuration instruction; it will be appreciated that this cache space is typically suspended under global variables so that items load relevant JavaScript packages from the cache space in time.
And step S15, if the target JavaScript packet does not exist in the preset cache space, loading the target JavaScript packet matched with the loading parameter from a server.
In the application, when the target JavaScript packet matched with the loading parameter does not exist in the preset cache space, the target JavaScript packet is not loaded with the three-party packet before, so that the target JavaScript packet needs to be loaded from the three-party packet server. In a specific embodiment, the loading, from the server, the target JavaScript packet matched with the loading parameter may include: loading a target JavaScript packet matched with the loading parameter from a server by adding a script tag, and judging whether the loading is completed within preset loading time; if not, loading the target JavaScript packet matched with the loading parameter from the server by adding the script tag again; if yes, generating first prompt information for representing that loading of the target JavaScript packet is completed. Specifically, in the process of loading the JavaScript package from the three-party package server, the target JavaScript package matched with the loading parameter is loaded by adding the script tag, whether the target JavaScript package is completed within the expected time can be judged according to the preset loading time in the loading process, if the target JavaScript package exceeds the preset loading time, the current JavaScript package loading failure can be judged, and then the target JavaScript package corresponding to the loading parameter can be loaded again by adding the script tag. Correspondingly, if the current target JavaScript packet is loaded in the preset loading time, first prompt information representing successful loading can be generated so as to prompt related staff.
In a specific embodiment, the method may further include: if the verification result represents that the verification of the loading parameter is unsuccessful, generating second prompt information based on the loading parameter; and displaying the first prompt information and the second prompt information through a preset man-machine interaction interface so as to facilitate relevant staff to process the loading process of the JavaScript packet. Specifically, when the verification result of the loading parameter of the JavaScript packet represents that verification fails, a second prompt message can be generated based on the loading parameter, and then a preset man-machine interaction interface can be utilized to display the related first prompt message or second prompt message, so that related staff can interfere the loading process of the JavaScript packet.
In another specific embodiment, after the target JavaScript packet matched with the loading parameter is loaded from the server, the method further includes: and caching the target JavaScript packet to the preset cache space hung under the global variable to update the JavaScript packet in the preset cache space. Specifically, after the target JavaScript package corresponding to the loading parameter is loaded from the three-party package server, the target JavaScript package can be cached to a preset cache space, and the preset cache space is usually hung under a global variable, so that the JavaScript package can be added in the preset cache space, and then the updated JavaScript package in the preset cache space can be used for loading the three-party package, so that the repeated loading of the JavaScript package from the three-party package server can be avoided.
Therefore, the application can cache the JavaScript packet loaded by the history through the preset cache space, and the subsequent JavaScript packet which is the same does not need to be loaded from a remote server side and can be loaded from the cache space in real time; thus, the problem that the volume of the project is overlarge because the traditional package manager packages the JavaScript package into the project is avoided; and the preset cache space can be hung under the global variable, the JavaScript packet can be loaded for multiple times, the additional repeated loading time is reduced, and the loading efficiency of the JavaScript packet is improved. Furthermore, the method and the device can load the three-party package which fails to be loaded for the first time from the three-party package server for the second time, thereby improving the reliability.
Referring to fig. 3, the embodiment of the invention discloses a three-party package loading method, which is applied to a client and comprises the following steps:
In the embodiment of the application, firstly, in project use, a three-party package loading method is triggered, and relevant loading parameters are transmitted; furthermore, the preset calibrator can accept all the loading parameters, and perform a series of checks on the loading parameters, if the check is not passed, the calibration enters an error processing module, and prompts the user or staff; correspondingly, if all the verification passes, the loading module is entered. The process of loading the module is shown in figure 4,
Firstly, according to the input loading parameters, searching whether the related three-party package is loaded in a preset cache space, and if so, directly executing a callback function input by the service and calling the three-party package. Correspondingly, if the preset cache space shows that the three-party package corresponding to the current loading parameter is not loaded, the JavaScript package can be loaded for the first time from the three-party package server by adding the script tag. And can monitor whether the JavaScript package is loaded completely after 2 seconds (preset loading time).
Further, if the first loading of the JavaScript packet is not completed within the preset loading time, deleting the first loaded script tag. And then carrying out secondary loading, monitoring whether loading is completed or not after 2 seconds, and if so, entering an error processing module to prompt the user to complete loading.
After the JavaScript packet is loaded, the packet needs to be cached by using a preset cache space, and if other configuration parameters aiming at the preset cache space are input under a window variable by default, the packet is cached at corresponding positions according to the configuration parameters.
Therefore, the application avoids the problem of overlarge project volume caused by the traditional package manager packaging the package into the project by a mode of loading in real time during remote storage and use. Furthermore, the small volume of the items can increase the speed of loading the items by the browser. In addition, by means of the preset cache space, the JavaScript packet loaded in the history is stored, and the three-party packet can be hung under the global variable, so that the effects of one-time loading and multiple-time use can be achieved, the time of multiple-time repeated loading is reduced, and the burden and the flow use of the system are reduced. It should be noted that the application can perform secondary loading, namely, can perform secondary loading of the pocket bottom under the condition of failure of primary loading, and avoids loading errors caused by network fluctuation. Meanwhile, a more perfect built-in error reporting mechanism is provided, and an error reporting module can be expanded by external parameter transmission. The method and the device can provide more perfect error reporting experience for the user.
As shown in fig. 5, an embodiment of the present application discloses a three-party package loading device, which is applied to a client, and includes:
the loading parameter obtaining module 11 is configured to obtain loading parameters for the JavaScript packet;
The loading parameter verification module 12 is configured to verify the loading parameter through a preset verifier to obtain a corresponding verification result;
The three-party packet judging module 13 is configured to judge whether a target JavaScript packet matched with the loading parameter exists in a preset cache space when the verification result indicates that the loading parameter is successfully verified; the preset cache space is used for caching the JavaScript packets loaded by the history;
a first three-party package loading module 14, configured to load the target JavaScript package from the preset buffer space when the target JavaScript package exists in the preset buffer space;
And the second three-party package loading module 15 is configured to load, from a server, the target JavaScript package matched with the loading parameter when the target JavaScript package does not exist in the preset buffer space.
Therefore, the application can cache the JavaScript packet loaded by the history through the preset cache space, and the subsequent JavaScript packet which is the same does not need to be loaded from a remote server side and can be loaded from the cache space in real time; therefore, the problem that the project volume is overlarge because the traditional package manager packages the JavaScript package into the project is avoided, the JavaScript package can be used for multiple times after being loaded once, the additional loading time is shortened, and the loading efficiency of the JavaScript package is improved.
In a specific embodiment, the loading parameter obtaining module 11 may include:
and the loading parameter acquisition unit is used for calling loading parameters for the JavaScript packet in the code of the current project.
In a specific embodiment, the loading parameter verification module 12 may include:
The first verification unit is used for verifying the parameter format of the loading parameter through a preset verifier to obtain a first verification result;
And the second verification unit is used for verifying the loading parameters through a custom verification rule in the preset verifier to obtain a second verification result.
In a specific embodiment, the second third party packet loading module 15 may include:
the loading judging unit is used for loading the target JavaScript packet matched with the loading parameter from the server by adding the script tag and judging whether the loading is completed within the preset loading time;
The jump unit is used for loading the target JavaScript packet matched with the loading parameter from the server again by adding the script tag when the loading is not completed within the preset loading time;
The first information generating unit is used for generating first prompt information representing that loading of the target JavaScript packet is completed when loading is completed within preset loading time.
In a specific embodiment, the apparatus may further include:
The second information generation unit is used for generating second prompt information based on the loading parameters when the verification result represents that the loading parameters are not successfully verified;
the information display unit is used for displaying the first prompt information and the second prompt information through a preset man-machine interaction interface so that relevant staff can process the loading process of the JavaScript packet.
In a specific embodiment, the apparatus may further include:
And the packet updating unit is used for caching the target JavaScript packet to the preset cache space hung under the global variable so as to update the JavaScript packet in the preset cache space.
In a specific embodiment, the apparatus may further include:
The position configuration unit is used for acquiring a position configuration instruction aiming at the preset cache space through a preset man-machine interaction interface so as to configure the position of the preset cache space based on the position configuration instruction.
Further, the embodiment of the present application further discloses an electronic device, and fig. 6 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the figure is not to be considered as any limitation on the scope of use of the present application.
Fig. 6 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is configured to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the three-party package loading method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further comprise a computer program capable of performing other specific tasks in addition to the computer program capable of performing the three-way package loading method performed by the electronic device 20 disclosed in any of the foregoing embodiments.
Further, the application also discloses a computer readable storage medium for storing a computer program; the method comprises the steps of loading a three-party package, wherein the three-party package loading method is disclosed in the prior art when the computer program is executed by a processor. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate 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 solution. 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 application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, 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 defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing has outlined rather broadly the more detailed description of the application in order that the detailed description of the application that follows may be better understood, and in order that the present principles and embodiments may be better understood; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.
Claims (10)
1. The three-party package loading method is characterized by being applied to a client and comprising the following steps of:
Acquiring loading parameters for a JavaScript packet;
Verifying the loading parameters through a preset verifier to obtain a corresponding verification result;
If the verification result represents that the verification of the loading parameter is successful, judging whether a target JavaScript packet matched with the loading parameter exists in a preset cache space; the preset cache space is used for caching the JavaScript packets loaded by the history;
if the target JavaScript packet exists in the preset cache space, loading the target JavaScript packet from the preset cache space;
and if the target JavaScript packet does not exist in the preset cache space, loading the target JavaScript packet matched with the loading parameter from a server.
2. The method for loading the three-party package according to claim 1, wherein the obtaining loading parameters for the JavaScript package comprises:
The loading parameters for the JavaScript package are invoked in the code of the current project.
3. The method for loading the three-party package according to claim 1, wherein the verifying the loading parameters by the preset verifier to obtain the corresponding verification result comprises:
checking the parameter format of the loading parameter through a preset checker to obtain a first checking result;
And verifying the loading parameters through a custom verification rule in the preset verifier to obtain a second verification result.
4. The method for loading the three-party package according to claim 1, wherein the loading the target JavaScript package matched with the loading parameters from the server comprises:
loading a target JavaScript packet matched with the loading parameter from a server by adding a script tag, and judging whether the loading is completed within preset loading time;
If not, loading the target JavaScript packet matched with the loading parameter from the server by adding the script tag again;
If yes, generating first prompt information for representing that loading of the target JavaScript packet is completed.
5. The method of three-party package loading according to claim 4, further comprising:
If the verification result represents that the verification of the loading parameter is unsuccessful, generating second prompt information based on the loading parameter;
And displaying the first prompt information and the second prompt information through a preset man-machine interaction interface so as to facilitate relevant staff to process the loading process of the JavaScript packet.
6. The method for loading the three-party package according to any one of claims 1 to 5, wherein after the target JavaScript package matched with the loading parameters is loaded from the server, further comprising:
and caching the target JavaScript packet to the preset cache space hung under the global variable to update the JavaScript packet in the preset cache space.
7. The method of three-party package loading according to claim 6, further comprising:
And acquiring a position configuration instruction aiming at the preset cache space through a preset man-machine interaction interface so as to configure the position of the preset cache space based on the position configuration instruction.
8. A three-way package loading device, applied to a client, comprising:
the loading parameter acquisition module is used for acquiring loading parameters aiming at the JavaScript packet;
the loading parameter verification module is used for verifying the loading parameters through a preset verifier to obtain corresponding verification results;
The three-party packet judging module is used for judging whether a target JavaScript packet matched with the loading parameter exists in a preset cache space or not when the verification result represents that the loading parameter is successfully verified; the preset cache space is used for caching the JavaScript packets loaded by the history;
The first three-party package loading module is used for loading the target JavaScript package from the preset buffer space when the target JavaScript package exists in the preset buffer space;
And the second-party package loading module is used for loading the target JavaScript package matched with the loading parameter from the server when the target JavaScript package does not exist in the preset cache space.
9. An electronic device, comprising:
a memory for storing a computer program;
A processor for executing the computer program to implement the three-way package loading method of any one of claims 1 to 7.
10. A computer readable storage medium for storing a computer program which when executed by a processor implements the three-way package loading method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410371289.1A CN118276972A (en) | 2024-03-29 | 2024-03-29 | Three-party package loading method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410371289.1A CN118276972A (en) | 2024-03-29 | 2024-03-29 | Three-party package loading method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118276972A true CN118276972A (en) | 2024-07-02 |
Family
ID=91644086
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410371289.1A Pending CN118276972A (en) | 2024-03-29 | 2024-03-29 | Three-party package loading method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118276972A (en) |
-
2024
- 2024-03-29 CN CN202410371289.1A patent/CN118276972A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20180046606A1 (en) | Form Checking Method and Apparatus | |
US10630671B2 (en) | Dynamic web services server | |
US9417938B2 (en) | Remote procedure call chains | |
US7920852B2 (en) | Compression of data transmitted between server and mobile device | |
US8880993B2 (en) | Handling unexpected responses to script executing in client-side application | |
CN109871499A (en) | Page loading method and client | |
WO2020233081A1 (en) | Client plugin-ization implementation method, apparatus, computer device and storage medium | |
CN109391673A (en) | A kind of method, system and the terminal device of management update file | |
EP3974960B1 (en) | Method and system for automated testing of web service apis | |
CN108021564A (en) | A kind of method and apparatus of page reorientation | |
CN112800194A (en) | Interface change identification method, device, equipment and storage medium | |
CN109885792B (en) | Webdriver technology-based APP bridging method | |
CN118276972A (en) | Three-party package loading method, device, equipment and storage medium | |
US20190138377A1 (en) | System and method for sending restful commands to uefi firmware using uefi variable services | |
CN115883512A (en) | DNS domain name processing method, device, system, equipment and medium | |
CN112765038B (en) | Distributed cluster software testing method, device, equipment and storage medium | |
CN113835732A (en) | Version updating method and related equipment | |
CN114257531B (en) | Test method and related device for application programming interface API gateway | |
US20190196945A1 (en) | Entity performance and usability analysis framework | |
CN110099096B (en) | Application program configuration method, device, computer equipment and storage medium | |
CN113407448B (en) | Grafana function management and control method and device, electronic equipment and medium | |
US20230091903A1 (en) | Iterative generation of hypertext transfer protocol traffic | |
CN115914019A (en) | ERP message data testing method, device, equipment and storage medium | |
CN117555584A (en) | Interface configuration and calling method, device, equipment and storage medium | |
CN117075871A (en) | Method, device, equipment and storage medium for generating calling code of application program interface |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination |