Dynamic Plug-in Configuration Method, Device, System, and Storage Medium

By generating and configuring dynamic plug-in configuration data by preset functions, the problems of low processing efficiency and waste of storage space in the existing technology are solved, efficient configuration and reuse of dynamic plug-ins are realized, and the functional scalability of web applications is improved.

CN115248705BActive Publication Date: 2025-07-25GAODING XIAMEN TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111004583.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-30
Publication Date
2025-07-25
Estimated Expiration
2041-08-30

AI Technical Summary

Technical Problem

The existing dynamic plug-in configuration methods lead to low processing efficiency, large space occupancy, heavy burden on compilation tools, and serious waste of storage space, making it difficult to achieve efficient configuration and reuse of dynamic plug-ins.

Method used

The dynamic plug-in configuration information is received through the preset function, the dynamic plug-in configuration data is generated, and the dynamic plug-in configuration data is packaged into an immediate execution function, and the version information is generated based on the hash value is configured to realize the diversification and reuse of dynamic plug-ins.

Benefits of technology

It realizes fast response and efficient processing of dynamic plug-ins, reduces the amount of data storage, reduces the waste of computing and storage resources, and improves the functional scalability of web applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115248705B_ABST
    Figure CN115248705B_ABST
Patent Text Reader

Abstract

The present invention provides a dynamic plug-in configuration method, device, system and storage medium, including: receiving dynamic plug-in configuration information based on a preset function, and performing fusion processing on the preset function and the dynamic plug-in configuration information to form dynamic plug-in configuration data; packing the dynamic plug-in configuration data into an immediately executable function, and the return value of the immediately executable function at least includes the dynamic plug-in configuration information; generating version information based on the hash value of the immediately executable function, and configuring the immediately executable function and the version information at corresponding storage addresses to complete the configuration of the dynamic plug-in. The technical solution provided by the present invention can pre-configure dynamic plug-ins, realize the diversification and reuse of dynamic plug-ins, increase the functions of web applications, improve the processing efficiency, and reduce the data storage amount at the same time. Moreover, it enables web applications to have dynamic and runtime extensibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of plug-in configuration, and in particular to a dynamic plug-in configuration method, device, system and storage medium. Background Art

[0002] When a user opens a web page based on a browser, the JavaScript code contained in the web page will be immediately downloaded, parsed, and run by the browser. The loading process of the JavaScript code will take a certain amount of time, during which the browser will be in a state where it cannot respond in real time, resulting in a poor user experience.

[0003] In order to solve the above user experience problems, in the field of front-end development of browser web pages, front-end web page developers use specific code compilation tools to process all JavaScript codes into different files in order to load and run certain JavaScript codes on demand and in a delayed manner. Some of these JavaScript files will only be loaded and run by the browser after specific logic is triggered.

[0004] The JavaScript code dynamic loading and running method achieved by using a JavaScript code compilation tool can realize the dynamic plug-in of code blocks, but there are the following problems:

[0005] 1. When the code is processed by the compilation tool, the web developer needs to pass all the code in the web page to the code compilation tool. This method will obviously put a heavy burden on the compilation tool. The compilation tool needs to run for a long time to compile, resulting in a waste of computer resources. Moreover, this process requires the participation of web developers, resulting in unnecessary consumption of human resources.

[0006] 2. After each code compilation process, the code files generated by the compilation tool are usually related to the current compilation activity. It is difficult to mix and match JavaScript files compiled from different batches. Therefore, the JavaScript files generated by each compilation process will occupy roughly the same computer storage space in the web backend system. The storage space increases linearly with the number of compilations, resulting in a waste of storage space.

[0007] In summary, existing dynamic plug-ins have the disadvantages of low processing efficiency and large space occupation. The fundamental reason for the above disadvantages is that existing dynamic plug-ins are not convenient to configure. Summary of the invention

[0008] An embodiment of the present invention provides a dynamic plug-in configuration method, device, system, and storage medium, which are easy to pre-configure dynamic plug-ins, realize the diversification and reuse of dynamic plug-ins, increase the functions of web applications, and reduce the data storage amount while having high processing efficiency.

[0009] In the first aspect of the embodiment of the present invention, a dynamic plug-in configuration method is provided, including:

[0010] Receiving dynamic plug-in configuration information based on a preset function, and fusing and processing the preset function and the dynamic plug-in configuration information to form dynamic plug-in configuration data;

[0011] Packaging the dynamic plug-in configuration data into an immediately-invoked function, and the return value of the immediately-invoked function at least includes the dynamic plug-in configuration information;

[0012] Generating version information based on the hash value of the immediately-invoked function, and configuring the immediately-invoked function and the version information at the corresponding storage address to complete the configuration of the dynamic plug-in.

[0013] Optionally, in a possible implementation manner of the first aspect, the preset function is a first function, and the dynamic plug-in configuration information at least includes a plug-in code block and meta-information;

[0014] Fusing and processing the received dynamic plug-in configuration information through a preset function to generate dynamic plug-in configuration data includes:

[0015] Receiving the plug-in code block and meta-information through the first function;

[0016] Generating an index code segment corresponding to the first function based on the plug-in code block and meta-information;

[0017] Processing the first function, the plug-in code block, the meta-information, and the index code segment to generate dynamic plug-in configuration data.

[0018] Optionally, in a possible implementation manner of the first aspect, the preset function is a Setter function, and the dynamic plug-in configuration information at least includes a plug-in code block and meta-information;

[0019] Fusing and processing the received dynamic plug-in configuration information through a preset function to generate dynamic plug-in configuration data includes:

[0020] Receiving the plug-in code block and meta-information through the Setter function;

[0021] Generating attribute information of the Setter function based on the plug-in code block and meta-information;

[0022] Process the Setter function, plug-in code block, meta information, and attribute information to generate dynamic plug-in configuration data.

[0023] Optionally, in a possible implementation manner of the first aspect, the immediately-executed function includes a first-stage function and a second-stage function;

[0024] Packaging the dynamic plug-in configuration data into an immediately-executed function includes that the return value of the immediately-executed function at least includes the dynamic plug-in configuration information, including:

[0025] Obtain the index code snippet and the edge data in the plug-in other than the dynamic plug-in configuration information, and generate a first-stage function based on the index code snippet and the edge data;

[0026] Generate a second-stage function based on the dynamic plug-in configuration data, and the second-stage function is the return value of the first-stage function.

[0027] Optionally, in a possible implementation manner of the first aspect, the immediately-executed function includes a first-stage function and a second-stage function;

[0028] Packaging the dynamic plug-in configuration data into an immediately-executed function includes that the return value of the immediately-executed function at least includes the dynamic plug-in configuration information, including:

[0029] Obtain the attribute information of the Setter function and the edge data in the plug-in other than the dynamic plug-in configuration information, and generate a first-stage function based on the attribute information of the Setter function and the edge data;

[0030] Generate a second-stage function based on the dynamic plug-in configuration data, and the second-stage function is the return value of the first-stage function.

[0031] Optionally, in a possible implementation manner of the first aspect, it further includes:

[0032] Receive plug-in version update data, where the plug-in version update data at least includes plug-in version update information and version information;

[0033] Generate a new immediately-executed function based on the version update information and the previous immediately-executed function;

[0034] Obtain the storage address corresponding to the version update data, and replace the previous immediately-executed function and version information with the new immediately-executed function and version information.

[0035] Optionally, in a possible implementation manner of the first aspect, the plug-in version update data includes name information;

[0036] Obtaining the storage address corresponding to the version update data includes:

[0037] Obtain the storage address corresponding to the name information based on a pre-set information table, where the information table includes the correspondence between the name information of each dynamic plug-in and the storage address.

[0038] In a second aspect of the embodiments of the present invention, a dynamic plug-in configuration device is provided, including:

[0039] A processing module, configured to receive dynamic plug-in configuration information based on a preset function, and fuse and process the preset function and the dynamic plug-in configuration information to form dynamic plug-in configuration data;

[0040] A packaging module, configured to package the dynamic plug-in configuration data into an immediately-executed function, and the return value of the immediately-executed function includes at least the dynamic plug-in configuration information;

[0041] A configuration module, configured to generate version information based on the hash value of the immediately-executed function, and configure the immediately-executed function and the version information at the corresponding storage address to complete the configuration of the dynamic plug-in.

[0042] In a third aspect of the embodiments of the present invention, a dynamic plug-in configuration system is provided, including:

[0043] A registration front end, configured to obtain the operation code of the user to generate dynamic plug-in configuration information;

[0044] A background configuration end, configured to receive the dynamic plug-in configuration information and execute the method according to any one of claims 1 to 7.

[0045] In a fourth aspect of the embodiments of the present invention, a readable storage medium is provided, in which a computer program is stored, and when the computer program is executed by a processor, it is used to implement the method according to the first aspect and various possible designs of the first aspect of the present invention.

[0046] A dynamic plug-in configuration method, device, system and storage medium provided by the present invention can pre-configure multiple dynamic plug-ins according to requirements, store the dynamic plug-ins uniformly, and when a web page needs to trigger a certain dynamic plug-in, the pre-stored dynamic plug-in can respond quickly and in a timely manner. During this process, no human intervention is required, there are many types of configurable dynamic plug-ins, and the same dynamic plug-in is only stored once, which has the advantages of high processing efficiency and less occupied space. Description of the Drawings

[0047] Figure 1 It is a flowchart of the first implementation manner of the dynamic plug-in configuration method;

[0048] Figure 2 It is a flowchart of the second implementation manner of the dynamic plug-in configuration method;

[0049] Figure 3 It is a flowchart of the third implementation manner of the dynamic plug-in configuration method;

[0050] Figure 4 It is a structural diagram of the first implementation manner of the dynamic plug-in configuration device. Specific implementation manner

[0051] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part rather than all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0052] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.

[0053] It should be understood that in various embodiments of the present invention, the magnitudes of the serial numbers of the processes do not mean the order of execution, and the order of execution of the processes should be determined by their functions and internal logics, and should not constitute any limitation to the implementation processes of the embodiments of the present invention.

[0054] It should be understood that in the present invention, "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0055] It should be understood that in the present invention, "a plurality of" means two or more. "And / or" is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. "Including A, B, and C" and "including A, B, C" mean that all of A, B, and C are included. "Including A, B, or C" means including any one of A, B, and C. "Including A, B, and / or C" means including any one or any two or all three of A, B, and C.

[0056] It should be understood that in the present invention, "B corresponding to A", "B corresponding to A relatively", "A corresponding to B relatively" or "B corresponding to A relatively" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information. The matching of A and B means that the similarity between A and B is greater than or equal to a preset threshold.

[0057] Depending on the context, as used herein, "if" can be interpreted as "when...", "when...", "in response to determining", or "in response to detecting".

[0058] The technical solutions of the present invention will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0059] Regarding the explanation of some terms in the present invention, Setter function: A function that calculates attributes; JavaScript: A programming language; Global object: Defined in one place and available everywhere; Object: A software set of some related variables and methods; Actual parameter: When calling a function with parameters, there is a data transfer relationship between the calling function and the called function. When calling a function in the calling function, the parameter in the parentheses after the function name is called the "actual parameter" (abbreviation "actual parameter"), and the actual parameter can be a constant, variable or expression; Setter function: Call it and pass in data, and this function determines how to process the data.

[0060] The main program of the web application on the browser side - it will undertake the task of loading and running dynamic plugins. When the JavaScript code of the web page runs, due to the design needs of internal business logic or the intention of the user, the application main body will trigger the loading and running logic of the plugin.

[0061] The plugin file management background system - this background system is used to manage information such as the version information of the plugin, the URL address of the JavaScript file of the plugin, and the name of the plugin. The outside world can initiate a network request with the name and version number of the plugin as parameters to query information such as the URL address of the JavaScript code file corresponding to the plugin with a specific name and version from the background.

[0062] Plugin - A plugin is composed of a JavaScript code block that can run independently and its description information such as name and version number.

[0063] The present invention provides a dynamic plugin configuration method, as Figure 1 shown, including:

[0064] Step S110: Receive dynamic plug-in configuration information based on a preset function, and fuse the preset function and the dynamic plug-in configuration information to form dynamic plug-in configuration data. The main purpose of this step is to define and set up the registration entry for the code required in the dynamic plug-in configuration process. Through this registration entry, the dynamic plug-in configuration information is input to form the dynamic plug-in configuration data.

[0065] In the first implementation manner of step S110, the preset function is the first function, and the dynamic plug-in configuration information includes at least a plug-in code block and meta-information.

[0066] As Figure 2 shown, step S110 includes:

[0067] Step S1111: Receive the plug-in code block and meta-information through the first function. Define a first function under the global object of JavaScript. This first function can receive a JavaScript Object object as a parameter. The dynamic plug-in configuration information can be a JavaScript Object object, and the JavaScript Object object includes at least a plug-in code block and meta-information.

[0068] Step S1112: Generate an index code snippet corresponding to the first function based on the plug-in code block and meta-information. After the plug-in composed of the first function and the JavaScript Object object is loaded, the outermost code snippet of the plug-in code will be used as the index code snippet to call the first function, and the actual parameter of the first function is a JavaScript object composed of the plug-in code block and meta-information.

[0069] Step S1113: Process the first function, the plug-in code block, the meta-information, and the index code snippet to generate dynamic plug-in configuration data. The dynamic plug-in configuration data already includes the basic functional code, index, etc. of the plug-in.

[0070] The application main body that loads the dynamic plug-in can obtain the relevant meta-information of the plug-in from the above-mentioned dynamic plug-in configuration data, give the working logic of the plug-in according to the working information provided by the application main body itself, and provide a programming interface (API) for the dynamic plug-in according to the plug-in logic.

[0071] The direct user of the dynamic plugin is the front-end JavaScript application running in the current web page. The JavaScript application can declare a plugin registration function under the global object. The form of the plugin registration function is not limited in this invention and can be any one or more of the preset function and the first function. For example: window.registerPlugin = function registerPlugin(plugin){...}. After a certain plugin is loaded and run, this registerPlugin will be called by the "bootstrap" code of the plugin code. The "bootstrap" code can be an index code snippet, etc. The call form is as follows:

[0072]

[0073]

[0074] The registerPlugin function declared by the main application can obtain the metadata represented by meta and the function where the plugin business logic represented by the activate function is located from the above code. The internal code of the registerPlugin function (equivalent to the plugin code block) will store and process the meta metadata (equivalent to the meta information), and call the activate function. When the activate function is called, the activate function will be passed the parameters represented by args. These parameters can be:

[0075] Some information data of the main application, used to let the plugin know the current state of the main application. The current state can be the attribute information of the web page opened in the current application. For example, the attribute information is that the web page is a ticket-purchasing software.

[0076] Some API functions of the main application, used to let the plugin initiate function calls to the main application.

[0077] In the second implementation manner of step S110, the preset function is the Setter function, and the dynamic plugin configuration information includes at least the plugin code block and the meta information.

[0078] As Figure 3 shown, step S110 includes:

[0079] Step S1121: Receive the plug-in code block and meta information through the Setter function. Define a property Setter function under the global object of JavaScript. This Setter function can receive a JavaScript Object as a parameter. The dynamic plug-in configuration information can be a JavaScript Object, and the JavaScript Object includes at least the plug-in code block and meta information.

[0080] Step S1122: Generate the property information of the Setter function based on the plug-in code block and meta information. After the plug-in composed of the Setter function and the JavaScript Object is loaded, the JavaScript object composed of the plug-in code block and meta information will be required to have corresponding properties. The Setter function of this property will be called, and the actual parameter of the Setter function is the JavaScript object composed of the plug-in code block and meta information.

[0081] Step S1123: Process the Setter function, plug-in code block, meta information, and property information to generate dynamic plug-in configuration data. The dynamic plug-in configuration data already includes the basic functional code, index, etc. of the plug-in.

[0082] The direct user of the dynamic plug-in is the front-end JavaScript application running in the current web page. This application can declare a setter function for plug-in registration. As shown below,

[0083]

[0084]

[0085] After a certain plug-in is loaded and run, the newPlugin property of pluginHub will be assigned by the "bootstrap" code of the plug-in code:

[0086] The setter function of the newPlugin property declared by the main application can obtain the metadata represented by meta and the function where the plug-in business logic represented by the activate function is located from the above code. The internal code of the setter function of the newPlugin property will store and process the meta metadata, and call the activate function. When the activate function is called, the activate function will be passed the parameters represented by args in the figure. These parameters can be:

[0087] Some information data of the main application, used to let the plug-in know the current state of the main application;

[0088] Some API functions of the main application are used to enable the plugin to initiate function calls to the main application.

[0089] In the two embodiments of step S110, the main differences lie in step S1112 and step S1122. In step S1112, the first function is called according to the index code snippet, and in step S1122, the Setter function is called according to the attribute information.

[0090] Step S120: Package the dynamic plugin configuration data into an immediately-invoked function, and the return value of the immediately-invoked function includes at least the dynamic plugin configuration information. In the present invention, all the code of the dynamic plugin will be packaged into an immediately-invoked function. The main purpose of packaging the dynamic plugin configuration data is to enable it to be registered at the main body used and applied by the dynamic plugin.

[0091] In the first embodiment of step S120, the immediately-invoked function includes a first-stage function and a second-stage function step.

[0092] Step S120 includes:

[0093] Step S1211: Obtain the index code snippet and the marginal data other than the dynamic plugin configuration information in the plugin, and generate a first-stage function based on the index code snippet and the marginal data. The part of the code written by the developer and irrelevant to plugin registration will be compiled into a first-stage function, and the return value of this first-stage function will be a JavaScript object composed of the plugin code block and meta-information. The code part irrelevant to plugin registration includes but is not limited to marginal data, index code snippets, etc.

[0094] Step S1212: Generate a second-stage function based on the dynamic plugin configuration data, and the second-stage function is the return value of the first-stage function. The second-stage function includes the dynamic plugin configuration data, so it also includes a JavaScript object composed of the plugin code block and meta-information.

[0095] The technical solution in the present invention divides the immediately-invoked function into two stages. The first-stage function is the marginal data other than the dynamic plugin configuration information, and its main purpose is to call the second-stage function. The second-stage function is the dynamic plugin configuration data, and its main purpose is to implement the functions of the plugin.

[0096] Inside the above immediately-invoked function, the JavaScript object will be called as a parameter, and plugin registration and configuration will be performed through the path in the first embodiment of step S110 above.

[0097] In the second embodiment of step S120, the immediately-invoked function includes a first-stage function and a second-stage function step.

[0098] Step S120 includes:

[0099] Step S1221: Obtain the attribute information of the Setter function and the edge data in the plugin except the dynamic plugin configuration information, and generate a piece of function based on the attribute information of the Setter function and the edge data. The code part written by the developer and irrelevant to plugin registration will be compiled into a piece of function, and the return value of this piece of function will be a JavaScript object composed of the plugin code block and meta-information. The code part irrelevant to plugin registration includes but is not limited to edge data, the attribute information of the Setter function, etc.

[0100] Step S1222: Generate a second piece of function based on the dynamic plugin configuration data, and the second piece of function is the return value of the first piece of function. The second piece of function includes the dynamic plugin configuration data, so it also includes a JavaScript object composed of the plugin code block and meta-information.

[0101] In the technical solution of the present invention, the immediately-executed function is divided into two pieces. The first piece of function is the edge data other than the dynamic plugin configuration information, and its main purpose is to call the second piece of function. The second piece of function is the dynamic plugin configuration data, and its main purpose is to implement the functions of the plugin.

[0102] Inside the above immediately-executed function, the JavaScript object will be called as a parameter, and plugin registration and configuration are performed through the path in the second implementation manner of step S110.

[0103] Step S130: Generate version information based on the hash value of the immediately-executed function, and configure the immediately-executed function and the version information at the corresponding storage address to complete the configuration of the dynamic plugin. The version information can be a version number, and the storage address can be a URL address.

[0104] After the dynamic plugin configuration information and data of the present invention are packaged in step S120, a new version number will be formed due to business needs or changes in characteristics such as the hash value of the generated code file. After obtaining the version number, the immediately-executed function and the version information are configured and stored at the corresponding URL address, and at this time, the initial configuration of the dynamic plugin is completed.

[0105] The technical solution of the present invention realizes the reuse of JavaScript code on the user-side browser side through the dynamic plugin method, thereby improving the waste of computing and storage resources caused by repeated compilation and repeated storage of code files.

[0106] The technical solution of the present invention divides the overall web page code into two categories: the main program and the plugin, enabling the main program to enhance its functions by loading and running the plugin during operation, so that the web application has dynamic and runtime extensibility.

[0107] The present invention further includes:

[0108] Receiving plug-in version update data, where the plug-in version update data at least includes plug-in version update information and version information. In an actual scenario, in order to meet different usage requirements, it is necessary to update and iterate the functions of dynamic plug-ins. The present invention can update the pre-configured dynamic plug-ins according to the received plug-in version update data.

[0109] Generating a new immediately-executed function based on the version update information and a previous immediately-executed function. When updating a dynamic plug-in, the steps of step S110 are repeated, and the new JavaScript Object included in the version update information is used as a parameter to generate a new immediately-executed function. When generating a new immediately-executed function, only the information and data in the two-segment function can be replaced.

[0110] Obtaining a storage address corresponding to the version update data, and replacing the previous immediately-executed function and version information with the new immediately-executed function and version information. After each dynamic plug-in is initially configured, a corresponding URL address will be assigned. Therefore, in order to save occupied space, when the same dynamic plug-in is updated and iterated, the information corresponding to the previous version of the dynamic plug-in will be replaced at the original URL address, that is, the previous immediately-executed function and version information are replaced with the new immediately-executed function and version information.

[0111] Through the above technical solutions, the version update function of dynamic plug-ins can be realized.

[0112] In a possible implementation manner, the plug-in version update data includes name information;

[0113] Obtaining a storage address corresponding to the version update data includes:

[0114] Obtaining the storage address corresponding to the name information based on a pre-set information table, where the information table includes the corresponding relationship between the name information of each dynamic plug-in and the storage address.

[0115] The present invention may include an information table, which associates the name information of the dynamic plug-in with the URL address, facilitating the retrieval and update of the dynamic plug-in.

[0116] The present invention also provides a dynamic plug-in configuration device, as Figure 4 shown, including:

[0117] A processing module, configured to receive dynamic plug-in configuration information based on a preset function, and fuse and process the preset function and the dynamic plug-in configuration information to form dynamic plug-in configuration data;

[0118] A packaging module, which is used to package the dynamic plug-in configuration data into an immediately-executed function, and the return value of the immediately-executed function includes at least the dynamic plug-in configuration information;

[0119] A configuration module, which is used to generate version information based on the hash value of the immediately-executed function, and configure the immediately-executed function and the version information at the corresponding storage address to complete the configuration of the dynamic plug-in.

[0120] The technical solution of the present invention realizes the reuse of JavaScript code on the user-side browser side through the dynamic plug-in method, thereby improving the waste of computing and storage resources caused by repeated compilation and repeated storage of code files.

[0121] The technical solution of the present invention divides the overall web page code into two categories: the main program and the plug-in, so that the main program can enhance its functions by loading and running the plug-in during operation, thereby enabling the web application to have dynamic and runtime extensibility.

[0122] The present invention also provides a dynamic plug-in configuration system, including:

[0123] A registration front end, which is used to obtain the operation code of the user to generate dynamic plug-in configuration information. The registration front end is used to load the above-mentioned web application main program on the browser side.

[0124] A background configuration end, including a plug-in file management background system, which is used to receive the dynamic plug-in configuration information and execute the following methods, including:

[0125] Receiving the dynamic plug-in configuration information based on a preset function, and fusing the preset function and the dynamic plug-in configuration information to form dynamic plug-in configuration data;

[0126] Packaging the dynamic plug-in configuration data into an immediately-executed function, and the return value of the immediately-executed function includes at least the dynamic plug-in configuration information;

[0127] Generating version information based on the hash value of the immediately-executed function, and configuring the immediately-executed function and the version information at the corresponding storage address to complete the configuration of the dynamic plug-in.

[0128] The technical solution of the present invention realizes the reuse of JavaScript code on the user-side browser side through the dynamic plug-in method, thereby improving the waste of computing and storage resources caused by repeated compilation and repeated storage of code files.

[0129] The technical solution of the present invention divides the overall web page code into two categories: the main program and the plug-in, so that the main program can enhance its functions by loading and running the plug-in during operation, thereby enabling the web application to have dynamic and runtime extensibility.

[0130] Among them, the readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium accessible by a general-purpose or special-purpose computer. For example, the readable storage medium is coupled to the processor, so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the readable storage medium can also exist as discrete components in a communication device. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0131] The present invention also provides a program product, which includes execution instructions stored in a readable storage medium. At least one processor of the device can read the execution instructions from the readable storage medium, and the execution of the execution instructions by at least one processor enables the device to implement the methods provided by the above various embodiments.

[0132] In the above embodiments of the terminal or the server, it should be understood that the processor can be a central processing unit (CPU for short), and can also be other general-purpose processors, digital signal processors (DSP for short), application specific integrated circuits (ASIC for short), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the present invention can be directly embodied as being executed and completed by a hardware processor, or can be executed and completed by a combination of hardware and software modules in the processor.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A dynamic plug-in configuration method, characterized in that, including: Receiving dynamic plug-in configuration information based on a preset function, and fusing and processing the preset function and the dynamic plug-in configuration information to form dynamic plug-in configuration data; Packaging the dynamic plug-in configuration data into an immediately-invoked function, and the return value of the immediately-invoked function includes at least the dynamic plug-in configuration information; Generating version information based on the hash value of the immediately-invoked function, and configuring the immediately-invoked function and the version information at corresponding storage addresses to complete the configuration of the dynamic plug-in; Wherein, the preset function is a first function, and the dynamic plug-in configuration information includes at least a plug-in code block and meta-information; The generation of dynamic plug-in configuration data by fusing and processing the received dynamic plug-in configuration information through a preset function includes: Receiving the plug-in code block and meta-information through the first function; Generating an index code segment corresponding to the first function based on the plug-in code block and meta-information; Processing the first function, the plug-in code block, the meta-information, and the index code segment to generate dynamic plug-in configuration data.

2. The dynamic plug-in configuration method according to claim 1, It is characterized in that Wherein, the preset function is a Setter function, and the dynamic plug-in configuration information includes at least a plug-in code block and meta-information; The generation of dynamic plug-in configuration data by fusing and processing the received dynamic plug-in configuration information through a preset function includes: Receiving the plug-in code block and meta-information through the Setter function; Generating attribute information of the Setter function based on the plug-in code block and meta-information; Processing the Setter function, the plug-in code block, the meta-information, and the attribute information to generate dynamic plug-in configuration data.

3. The dynamic plug-in configuration method according to claim 1, characterized in that The immediately-invoked function includes a first-stage function and a second-stage function; The packaging of the dynamic plug-in configuration data into an immediately-invoked function, and the return value of the immediately-invoked function including at least the dynamic plug-in configuration information includes: Obtaining an index code segment and edge data in the plug-in other than the dynamic plug-in configuration information, and generating a first-stage function based on the index code segment and the edge data; Generating a second-stage function based on the dynamic plug-in configuration data, and the second-stage function is the return value of the first-stage function.

4. The dynamic plug-in configuration method according to claim 2, characterized in that The immediately-invoked function includes a first-stage function and a second-stage function; The packaging of the dynamic plug-in configuration data into an immediately-invoked function, and the return value of the immediately-invoked function including at least the dynamic plug-in configuration information includes: Obtaining the attribute information of the Setter function and edge data in the plug-in other than the dynamic plug-in configuration information, and generating a first-stage function based on the attribute information of the Setter function and the edge data; Generating a second-stage function based on the dynamic plug-in configuration data, and the second-stage function is the return value of the first-stage function.

5. The dynamic plug-in configuration method according to claim 1, characterized in that It further includes: Receiving plug-in version update data, where the plug-in version update data includes at least plug-in version update information and version information; Generating a new immediately-invoked function based on the version update information and the previous immediately-invoked function; Obtain the storage address corresponding to the version update data, and replace the previous immediately-executed function and version information with the new immediately-executed function and version information.

6. The dynamic plug-in configuration method according to claim 1, wherein: The plug-in version update data includes name information; Obtaining the storage address corresponding to the version update data includes: Obtaining the storage address of the name information based on a pre-set information table, where the information table includes the corresponding relationship between the name information of each dynamic plug-in and the storage address.

7. A dynamic plug-in configuration device, characterized in that, It includes: A processing module, configured to receive dynamic plug-in configuration information based on a preset function, and fuse the preset function and the dynamic plug-in configuration information to form dynamic plug-in configuration data; A packaging module, configured to package the dynamic plug-in configuration data into an immediately-executed function, and the return value of the immediately-executed function at least includes the dynamic plug-in configuration information; A configuration module, configured to generate version information based on the hash value of the immediately-executed function, and configure the immediately-executed function and the version information at the corresponding storage address to complete the configuration of the dynamic plug-in; Wherein, the preset function is a first function, and the dynamic plug-in configuration information at least includes a plug-in code block and meta information; Generating dynamic plug-in configuration data by fusing the received dynamic plug-in configuration information through a preset function includes: Receiving the plug-in code block and meta information through the first function; Generating an index code segment corresponding to the first function based on the plug-in code block and meta information; Processing the first function, the plug-in code block, the meta information, and the index code segment to generate dynamic plug-in configuration data.

8. A dynamic plug-in configuration system, characterized in that It includes: A registration front end, configured to obtain the operation code of the user to generate dynamic plug-in configuration information; A background configuration end, configured to receive the dynamic plug-in configuration information and execute the method according to any one of claims 1 to 6.

9. A readable storage medium, characterized in that, A computer program is stored in the readable storage medium, and when the computer program is executed by a processor, it is used to implement the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and system for accessing SDK (software development kits)

    CN106843978A

  • Web front end plugin and method for carrying out scheduling and communication on basis of Web front end plugin

    CN108446141A

  • Web application-based page plug-in method, device and equipment

    CN111813385A