Programming interface loading method, device, electronic device and storage medium
By preloading and generating intermediate files before loading the programming interface, the problem of too long loading time of the programming interface is solved, and faster loading speed and better user experience are achieved.
Patent Information
- Application Number
- CN202210349593.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-02
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2042-04-02
AI Technical Summary
During the loading process of existing programming interfaces, the loading and parsing of project files takes a long time, resulting in a long loading time for programming interfaces and affecting the user experience.
Before detecting the programming interface entry instructions, the required project files are preloaded, intermediate files are generated, and these intermediate files are directly used when the interface is loaded to reduce the parsing process.
By preloading intermediate files, the loading time of the programming interface is significantly reduced and the user experience is improved.
Smart Images

Figure CN114647411B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a programming interface loading method, device, electronic device and storage medium. Background Art
[0002] As programming learning becomes more and more popular, more and more people are starting to learn programming. Graphical programming encapsulates the underlying implementation, and users only need to drag and drop programming components to practice programming questions. In the existing programming learning process, users first learn the basic knowledge related to programming, and then the system provides programming questions and loads the integrated development environment (IDE) (the integrated development environment can be understood as a programming interface) to practice programming questions in the programming interface of the graphical programming software.
[0003] However, in the process of loading the programming interface of the graphical programming software, it takes a long time to load and parse the project file, which results in a long loading time for the programming interface. The user needs to wait for a long time, which affects the user experience. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a programming interface loading method, device, electronic device and storage medium, so as to improve the loading speed of the programming interface.
[0005] In a first aspect, the present application provides a programming interface loading method, the method comprising: before detecting a programming interface entry instruction, preloading the project files required to load the programming interface, generating one or more intermediate state files, and saving the intermediate state files; when detecting the programming interface entry instruction, obtaining the intermediate state files, and loading the programming interface according to the intermediate state files.
[0006] In the above implementation process, before detecting the programming interface entry instruction, the project files required for loading the programming interface are preloaded to obtain one or more intermediate state files, and these intermediate state files are saved. In this way, when the programming interface needs to be loaded, there is no need to perform the corresponding parsing process on the project files, and the intermediate state files obtained by preloading can be directly obtained, and then these intermediate state files are used to load the programming interface, thereby reducing the time for loading the programming interface and improving the user experience.
[0007] In an optional implementation, the project files required for loading the programming interface are preloaded to generate one or more intermediate files, including: parsing the project files to generate a first intermediate file; wherein the first intermediate file is a description file of the programming interface.
[0008] In the above implementation process, the first intermediate state file is determined in the above manner, so that when the programming interface entry instruction is detected later, the first intermediate state file can be obtained, and the programming interface is loaded according to the first intermediate state file. In this way, the time for parsing the project file into the description file of the programming interface (i.e., the first intermediate state file) is reduced, and the loading speed of the programming interface is improved.
[0009] In an optional implementation, the project files required for loading the programming interface are preloaded to generate one or more intermediate files, and also include: decompressing the project files based on a preset decompression library to determine the resource files; deserializing and parsing the resource files according to the first intermediate files to generate a second intermediate file; wherein the second intermediate file is the resource on which loading the programming interface depends.
[0010] In the above implementation process, the second intermediate state file is determined in the above manner, and when the programming interface entry instruction is subsequently detected, the second intermediate state file can be obtained, and the programming interface is loaded according to the second intermediate state file. In this way, the time required to determine the resources (i.e., the second intermediate state file) on which the programming interface depends is reduced, and the loading speed of the programming interface is improved.
[0011] In an optional implementation, the preloading of the project files required to load the programming interface to generate one or more intermediate files also includes: determining the mapping relationship between roles and resources in the programming interface based on the first intermediate file and the second intermediate file; and generating a third intermediate file based on the mapping relationship and the second intermediate file.
[0012] In the above implementation process, the third intermediate state file is determined in the above manner, and when the programming interface entry instruction is detected later, the third intermediate state file can be obtained, and the programming interface is loaded according to the third intermediate state file. This reduces the time required to determine the mapping relationship between roles and resources in the programming interface and generate the third intermediate state file, and improves the loading speed of the programming interface.
[0013] In an optional implementation, the first intermediate file is a projectJson object, the second intermediate file is a data object, and the third intermediate file is a target object.
[0014] In an optional implementation, the programming interface is an interface of a scratch IDE.
[0015] In an optional implementation, before preloading the project file required for loading the programming interface and generating one or more intermediate files, the method further includes: requesting the project file from a server and saving the project file.
[0016] In the above implementation process, the project file required for loading the programming interface is requested from the server in advance, and the project file is saved. The project file is obtained in advance during idle time, so that when the project file is needed later, it can be directly downloaded without downloading, thereby reducing the time for loading the programming interface.
[0017] In an optional implementation, the intermediate file and the project file are cached in a preset database.
[0018] In the second aspect, the present application provides a programming interface loading device, including: a generation module, used to pre-load the project files required to load the programming interface before detecting the programming interface entry instruction, generate one or more intermediate state files and save the intermediate state files; a loading module, used to obtain the intermediate state file when the programming interface entry instruction is detected, and load the programming interface according to the intermediate state file.
[0019] In an optional implementation, the generation module is specifically used to parse the project file to generate a first intermediate file; wherein the first intermediate file is a description file of the programming interface.
[0020] In an optional implementation, the generation module is specifically used to decompress the project file based on a preset decompression library to determine the resource file; deserialize and parse the resource file according to the first intermediate file to generate a second intermediate file; wherein the second intermediate file is the resource on which the loading of the programming interface depends.
[0021] In an optional implementation, the generation module is specifically used to determine a mapping relationship between roles and resources in the programming interface based on the first intermediate state file and the second intermediate state file; and generate a third intermediate state file according to the mapping relationship and the second intermediate state file.
[0022] In an optional implementation, the first intermediate file is a projectJson object, the second intermediate file is a data object, and the third intermediate file is a target object.
[0023] In an optional implementation, the programming interface is an interface of a scratch IDE.
[0024] In an optional implementation, the device further includes: a request module, configured to request the project file from a server and save the project file.
[0025] In an optional implementation, the intermediate file and the project file are cached in a preset database.
[0026] In a third aspect, the present application provides an electronic device comprising a processor, a communication interface, a memory and a bus; the processor and the memory communicate with each other through the bus; the communication interface is used to communicate signaling or data with other node devices; the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute a method as described in any of the foregoing embodiments.
[0027] In a fourth aspect, the present application provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are read and executed by a computer, the method described in any one of the aforementioned embodiments is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 A flowchart of a programming interface loading method provided in an embodiment of the present application;
[0030] Figure 2 A flowchart of another programming interface loading method provided in an embodiment of the present application;
[0031] Figure 3 A structural block diagram of a programming interface loading device provided in an embodiment of the present application;
[0032] Figure 4 A schematic diagram of the structure of an electronic device according to an embodiment of the present application.
[0033] Icons: 300 - programming interface loading device; 301 - generation module; 302 - loading module; 303 - request module; 400 - electronic device; 401 - processor; 402 - communication interface; 403 - memory; 404 - bus. DETAILED DESCRIPTION
[0034] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0035] Embodiment 1:
[0036] In order to improve the loading speed of the programming interface, a programming interface loading method is provided in the embodiment of the present application. Figure 1 As shown, Figure 1 This is a flowchart of a programming interface loading method provided in an embodiment of the present application, and the programming interface loading method includes:
[0037] S101: before detecting a programming interface entry instruction, pre-loading the project files required for loading the programming interface, generating one or more intermediate state files, and saving the intermediate state files.
[0038] S102: When a programming interface entry instruction is detected, an intermediate state file is obtained, and the programming interface is loaded according to the intermediate state file.
[0039] It should be noted that the executor of the programming interface loading method provided in the embodiment of the present application can be an electronic device with a display function, such as a mobile phone, a tablet computer, etc., so as to display the loaded programming interface; the electronic device can also be a desktop computer host, a server, etc., which can display the loaded programming interface through an external display.
[0040] It should also be noted that loading the programming interface in the present application refers to the operation process performed by the electronic device to display the programming interface after receiving the programming interface entry instruction.
[0041] The above method is introduced in detail below.
[0042] S101: before detecting a programming interface entry instruction, pre-loading the project files required for loading the programming interface, generating one or more intermediate state files, and saving the intermediate state files.
[0043] It should be noted that when the electronic device receives the programming interface entry instruction, it means that the user needs to enter the programming interface to operate. In other words, when the electronic device receives the programming interface entry instruction, it needs to load the programming interface and present the programming interface to the user.
[0044] In some embodiments, the programming interface entry instruction can be triggered by a user operation, for example: after clicking the entry button corresponding to a certain programming exercise question, the programming interface entry instruction is triggered; or, after completing the programming exercise question and exiting the programming interface of the current exercise question, after clicking the entry button to enter the programming interface again, the programming interface entry instruction is triggered, etc. In other embodiments, the programming interface entry instruction can also be triggered by a pre-set control logic, for example: after a certain page is displayed, the programming interface entry instruction is automatically generated. This application does not specifically limit the method for generating the programming interface entry instruction.
[0045] In the embodiment of the present application, in order to improve the loading speed of the programming interface, before the programming interface entry instruction is detected (i.e., before the programming interface needs to be loaded), the engineering files required to load the programming interface are preloaded, one or more intermediate state files are generated, and the intermediate state files are saved. It should be noted that the above process is executed in the background of the electronic device, and the display area of the electronic device displays the page currently browsed by the user, which is imperceptible to the user, and the user will not notice it, so it will not interfere with the normal use of the user.
[0046] After one or more intermediate state files are generated, these intermediate state files may be saved for the convenience of subsequent use.
[0047] In the embodiments of the present application, there may be multiple ways to save the intermediate state file. For example, in some embodiments, the intermediate state file may be stored on a non-volatile storage medium such as a hard disk of an electronic device, and the intermediate state file may be directly obtained from the non-volatile storage medium later. In other embodiments, the intermediate state file may also be cached in a preset database, so that the intermediate state file can be quickly called when the programming interface needs to be loaded later. The database may be an indexed database (indexedDB), Mysql, etc., and the present application does not specifically limit this.
[0048] For example, a user learns graphical programming knowledge through a computer, and the learning content can be divided into basic knowledge learning (i.e. learning related knowledge by watching videos, etc.) and programming question exercises. In the process of the user learning basic knowledge, the display area of the computer displays the page for the user to learn basic knowledge, and the computer background can execute the above S101 to preload the project files required to load the programming interface, generate one or more intermediate state files, and save the intermediate state files.
[0049] It can be understood that the above example is only a specific usage scenario provided by the embodiment of the present application, and the present application is not limited to this. The programming interface loading method provided by the embodiment of the present application can be applied to any scenario that requires loading a programming interface.
[0050] Through the above method, before the programming interface needs to be loaded, the project files required for loading the programming interface are preloaded to obtain one or more intermediate state files, and these intermediate state files are saved. When the programming interface needs to be loaded (that is, when the electronic device receives the programming interface entry instruction), there is no need to perform the corresponding parsing process on the project file, and the intermediate state files obtained by preloading can be directly obtained, and then the programming interface is loaded using these intermediate state files, thereby reducing the time for loading the programming interface and improving the user experience.
[0051] Before preloading the project files required for loading the programming interface, it is necessary to first obtain the project files. Therefore, before the above S101, the programming interface loading method provided in the embodiment of the present application may further include:
[0052] Request the project file from the server and save the project file.
[0053] It should be understood that the engineering files required for loading the programming interface are usually stored in the server. When the programming interface needs to be loaded, the engineering files are requested from the server (i.e., the engineering files are downloaded). The network conditions, the load of the server, and the size of the engineering files will affect the speed of loading the programming interface. Since the above steps are performed before S101, the above steps are also performed before the programming interface entry instruction is detected. Therefore, the engineering files required for loading the programming interface are requested from the server in advance, and the engineering files are saved. The engineering files are obtained in advance during idle time, so that when the engineering files are needed in the future, they can be directly downloaded without downloading, thereby reducing the time for loading the programming interface.
[0054] In some other implementations, when it is necessary to obtain project files, the electronic device may also be connected to storage media such as USB and CDs to obtain project files from these storage media. This application does not specifically limit the method for obtaining project files.
[0055] In addition, the method of saving the project file can be the same as the method of saving the intermediate state file mentioned above, and in order to make the description concise, it will not be repeated here.
[0056] In the embodiment of the present application, the programming interface may be an interface of a scratch IDE, an interface of a Python IDE, etc., but this is not intended to be limiting.
[0057] To facilitate understanding of this solution, the following uses the interface of the scratch IDE as an example to introduce the above content.
[0058] In the scenario where scratch is used as a programming tool, the programming interface is the interface of the scratch IDE. The project file used to load the scratch IDE interface is the sb3 file, which includes various materials (such as picture materials, audio and video materials, etc.) required to load the scratch IDE interface, the corresponding relationship between materials and roles, etc.
[0059] The sb3 file is requested from the server through the fetch request. The data type of the sb3 file is in binary large object (blob) format. Specifically, the sb3 file in blob format can be obtained through the response.blob() instruction. The blob format file has the advantages of being easy to save and parse.
[0060] The following describes the process of generating an intermediate state file.
[0061] In an optional implementation of the embodiment of the present application, the engineering files required for loading the programming interface are preloaded to generate one or more intermediate state files, including the following contents:
[0062] The project file is parsed to generate a first intermediate state file.
[0063] In this implementation, the first intermediate state file is a description file of the programming interface.
[0064] In the implementation mode of the present application, when loading the programming interface, a series of parsing processes need to be performed on the project file to complete the loading of the programming interface. In order to reduce the loading time, before the programming interface entry instruction is detected, the project file is parsed to parse out the description file of the programming interface, and the description file is used as the first intermediate state file.
[0065] The above content is still introduced by taking the interface of scratch IDE as an example.
[0066] After obtaining the sb3 file (ie, the project file), the sb3 file is parsed through scratch-parser to generate a projectJson object (ie, the first intermediate state file).
[0067] The first intermediate state file is generated in the above manner, so that when the programming interface entry instruction is detected subsequently, the first intermediate state file can be directly obtained, and the programming interface is loaded according to the first intermediate state file, which reduces the time of parsing the project file into the description file of the programming interface and improves the loading speed of the programming interface.
[0068] In order to further improve the loading speed of the programming interface, after generating the first intermediate state file, the engineering files required for loading the programming interface are preloaded to generate one or more intermediate state files, including the following contents:
[0069] Decompress the project files based on the preset decompression library and determine the resource files;
[0070] The resource file is deserialized and parsed according to the first intermediate file to generate a second intermediate file.
[0071] In this implementation manner, the second intermediate state file is a resource on which the loading programming interface depends.
[0072] In the implementation mode of the present application, when loading the programming interface, in addition to parsing the project file to determine the description file of the programming interface (i.e., the first intermediate state file), it is also necessary to decompress the project file to determine the resources on which the loading programming interface depends. Therefore, after generating the first intermediate state file, the project file is decompressed based on the preset decompression library to determine the resource file. After determining the resource file, the resource file is deserialized and parsed according to the description file, thereby generating the resources on which the loading of the programming interface depends (i.e., the second intermediate state file).
[0073] The above content is still introduced by taking the interface of scratch IDE as an example.
[0074] After determining the projectJson object (i.e. the first intermediate file), call JSZip.loadAsync (decompression library) to decompress the sb3 file (i.e. the project file), generate a zip object (i.e. the resource file), deserialize and parse the zip object according to the projectJson object, and generate a data object (i.e. the second intermediate file). It should be noted that since the zip object cannot be saved, it is necessary to deserialize and parse the zip object according to the projectJson object to generate a savable data object as the second intermediate file, so that the data object can be used to load the scratch IDE interface later.
[0075] The data object is the resources that the scratch IDE interface depends on, including audio resources, image resources, svg animation resources, etc.
[0076] By determining the second intermediate state file in the above manner, when a programming interface entry instruction is subsequently detected, the second intermediate state file can be directly obtained, and the programming interface can be loaded according to the second intermediate state file, thereby reducing the time required to determine the resources (i.e., the second intermediate state file) on which the programming interface depends for loading, and improving the loading speed of the programming interface.
[0077] In order to further improve the loading speed of the programming interface, after generating the second intermediate state file, the engineering files required for loading the programming interface are preloaded to generate one or more intermediate state files, including the following contents:
[0078] Determine a mapping relationship between roles and resources in a programming interface based on the first intermediate state file and the second intermediate state file;
[0079] A third intermediate file is generated according to the mapping relationship and the second intermediate file.
[0080] In an implementation manner of the present application, in the process of loading a programming interface, after determining the description file (i.e., the first intermediate state file) and the resources on which the loaded programming interface depends (i.e., the second intermediate state file), it is necessary to further determine the mapping relationship between roles and resources in the programming interface, and generate a third intermediate state file for loading the programming interface based on the resource relationship and the resources on which the loaded programming interface depends.
[0081] The above content is still introduced by taking the interface of scratch IDE as an example.
[0082] After determining the projectJson object (i.e., the first intermediate file) and the data object (i.e., the second intermediate file), the scratch role is traversed according to the description information of the programming interface in the projectJson object, and the correspondence between the resources in the data object and the scratch role is determined. According to the correspondence, the data object is converted into a target object (i.e., the third intermediate file) so that the target object can be used to load the scratch IDE interface later.
[0083] The third intermediate state file is determined in the above manner. When the programming interface entry instruction is subsequently detected, the third intermediate state file can be directly obtained, and the programming interface is loaded according to the third intermediate state file, which reduces the time required to determine the mapping relationship between roles and resources in the programming interface (i.e., the second intermediate state file) and improves the loading speed of the programming interface.
[0084] In an optional implementation, after the first intermediate state file, the second intermediate state file and the third intermediate state file are generated, in order to facilitate the subsequent use of these intermediate state files, the first intermediate state file, the second intermediate state file and the third intermediate state file can be saved in an index database. Taking advantage of the fast response speed of indexedDB, when the programming interface entry instruction is detected later, the intermediate state file can be quickly retrieved from indexedDB to load the programming interface, thereby improving the loading speed of the programming interface.
[0085] S102: When a programming interface entry instruction is detected, an intermediate state file is obtained, and the programming interface is loaded according to the intermediate state file.
[0086] It should be noted that in actual application, the time used for preloading may be different. In some embodiments, if the time used for preloading is short and only enough to generate the first intermediate state file, the electronic device detects the programming interface entry instruction, then obtains the saved first intermediate state file, and loads the programming interface according to the first intermediate state file. It can be understood that in this embodiment, when loading the programming interface, it is necessary to further generate the second intermediate state file and the third intermediate state file, and then load the programming interface according to the third intermediate state file.
[0087] If the time for preloading is long, and the first intermediate state file and the second intermediate state file are generated during the preloading process, the first intermediate state file and the second intermediate state file are obtained, and the programming interface is loaded according to the first intermediate state file and the second intermediate state file. It can be understood that in this embodiment, when loading the programming interface, it is only necessary to further generate the third intermediate state file, and then load the programming interface according to the third intermediate state file.
[0088] If the time used for preloading is long enough, and the first intermediate state file, the second intermediate state file and the third intermediate state file are generated during the preloading process, the programming interface can be directly loaded according to the third intermediate state file.
[0089] The process of loading the programming interface according to the third intermediate state file may include rendering the programming interface and displaying the corresponding programming interface on the display of the electronic device. For the specific rendering process and display process, please refer to the prior art and will not be described in detail here.
[0090] In summary, the embodiment of the present application provides a programming interface loading method, which preloads the engineering files required for loading the programming interface before the programming interface needs to be loaded, obtains one or more intermediate state files, and saves these intermediate state files. When the programming interface needs to be loaded (that is, when the electronic device receives a programming interface entry instruction), there is no need to perform a corresponding parsing process on the engineering file, and the intermediate state files obtained by preloading can be directly obtained, and then the programming interface is loaded using these intermediate state files, thereby reducing the time for loading the programming interface and improving the user experience.
[0091] Embodiment 2:
[0092] This embodiment is based on the first embodiment. Figure 2 As an example, this application is further illustrated.
[0093] This embodiment takes the programming tool scratch as an example for explanation.
[0094] Before the programming interface enters the command (corresponding to Figure 2 Preload in), first, request the sb3 file from the server through a fetch request. The data type of the sb3 file is blob, and the sb3 file is cached in indexedDB in the form of blob. Secondly, parse the sb3 file through scratch-parser to obtain the projectJson object, and cache the projectJson object in indexedDB. Then, call JSZip.loadAsync to decompress the sb3 file and determine the zip object. After determining the zip object, deserialize and parse the zip object according to the projectJson object, determine the data object, and cache the data object in indexedDB. Finally, traverse the scratch role according to the description information of the programming interface in the projectJson object, determine the correspondence between the resources in the data object and the scratch role, convert the data object into a target object according to the correspondence, and cache the target object in indexedDB.
[0095] When the programming interface enters the command (corresponding to Figure 2 In the formal loading), the target object is obtained from indexedDB, the programming interface is rendered according to the target object, and the corresponding programming interface is displayed on the display of the electronic device to complete the loading of the programming interface.
[0096] Through the above scheme, before the programming interface entry instruction is detected, the project files required to load the programming interface are preloaded, the target object is gradually generated, and the target object is saved in indexedDB. When the programming interface entry instruction is detected, the target object is directly obtained from indexedDB, and the programming interface is loaded using the target object, without the need to perform the corresponding parsing process on the project file, thereby reducing the time to load the programming interface after the programming interface entry instruction is detected, and improving the user experience.
[0097] Embodiment three:
[0098] Based on the same inventive concept, the present application also provides a programming interface loading device. Figure 3 , Figure 3 This is a structural block diagram of a programming interface loading device provided in an embodiment of the present application. The programming interface loading device 300 may include:
[0099] A generating module 301 is used to preload the engineering files required for loading the programming interface before detecting the programming interface entry instruction, generate one or more intermediate state files and save the intermediate state files;
[0100] The loading module 302 is used to obtain the intermediate state file when detecting the programming interface entry instruction, and load the programming interface according to the intermediate state file.
[0101] In an optional implementation, the generating module 301 is specifically used to parse the project file to generate a first intermediate file; wherein the first intermediate file is a description file of the programming interface.
[0102] In an optional implementation, the generation module 301 is specifically used to decompress the project file based on a preset decompression library to determine the resource file; deserialize and parse the resource file according to the first intermediate file to generate a second intermediate file; wherein the second intermediate file is the resource on which the loading of the programming interface depends.
[0103] In an optional implementation, the generation module 301 is specifically used to determine the mapping relationship between roles and resources in the programming interface based on the first intermediate file and the second intermediate file; and generate a third intermediate file according to the mapping relationship and the second intermediate file.
[0104] In an optional implementation, the first intermediate file is a projectJson object, the second intermediate file is a data object, and the third intermediate file is a target object.
[0105] In an optional implementation, the programming interface is an interface of a scratch IDE.
[0106] In an optional implementation manner, the device further includes: a request module 303, configured to request the project file from a server and save the project file.
[0107] In an optional implementation, the intermediate file and the project file are cached in a preset database.
[0108] Embodiment 4:
[0109] See also Figure 4 , Figure 4This is a schematic diagram of the structure of an electronic device 400 of an embodiment of the present application, and the electronic device 400 includes: at least one processor 401, at least one communication interface 402, at least one memory 403 and at least one bus 404. Among them, the bus 404 is used to realize the direct connection and communication of these components, the communication interface 402 is used to communicate signaling or data with other node devices, and the memory 403 stores program instructions executable by the processor 401. When the electronic device 400 is running, the processor 401 communicates with the memory 403 through the bus 404, and when the program instructions are executed by the electronic device 400, the above-mentioned programming interface loading method is implemented.
[0110] The electronic device 400 may further include a display, and the display is used to display the loaded programming interface.
[0111] The processor 401 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 401 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. It can implement or execute various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0112] The memory 403 may include but is not limited to random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable read-only memory (EEPROM), etc.
[0113] Understandably, Figure 4 The structure shown is for illustration only. The electronic device 400 may also include Figure 4More or fewer components as shown, or with Figure 4 Different configurations are shown. Figure 4 Each component shown in can be implemented by hardware, software or a combination thereof. In the embodiment of the present application, the electronic device 400 can be, but not limited to, a physical device such as a desktop computer, a laptop computer, a smart phone, a smart wearable device, a vehicle-mounted device, etc., and can also be a virtual device such as a virtual machine. In addition, the electronic device 400 is not necessarily a single device, but can also be a combination of multiple devices, such as a server cluster, etc.
[0114] In addition, this embodiment further provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are read and executed by a computer, the programming interface loading method in the above embodiment is executed.
[0115] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0116] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0117] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0118] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM) random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0119] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0120] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A programming interface loading method, characterized in that: The method comprises: Before detecting the programming interface entry instruction, the project file required for loading the programming interface is parsed to generate a first intermediate file; wherein the project file includes the materials required for loading the programming interface and the corresponding relationship between the materials and the roles; the first intermediate file is a description file of the programming interface; the project file is decompressed based on a preset decompression library to determine the resource file; the resource file is deserialized and parsed according to the first intermediate file to generate a second intermediate file; wherein the second intermediate file is the resource on which the loading of the programming interface depends; the mapping relationship between the roles and the resources in the programming interface is determined based on the first intermediate file and the second intermediate file; a third intermediate file is generated according to the mapping relationship and the second intermediate file; When the programming interface entry instruction is detected, the third intermediate state file is acquired, the programming interface is rendered according to the third intermediate state file, and the programming interface is displayed on the display of the electronic device.
2. The method according to claim 1, characterized in that The first intermediate file is a projectJson object, the second intermediate file is a data object, and the third intermediate file is a target object.
3. The method according to claim 1 or 2, characterized in that: The programming interface is the interface of the scratch IDE.
4. The method according to claim 1 or 2, characterized in that: Before preloading the engineering files required for loading the programming interface and generating one or more intermediate state files, the method further includes: The project file is requested from the server and saved.
5. The method according to claim 1 or 2, characterized in that: The intermediate state file and the project file are cached in a preset database.
6. A programming interface loading device, characterized in that: include: A generation module, used for parsing the project file required for loading the programming interface before detecting the programming interface entry instruction, and generating a first intermediate state file; wherein the project file includes the materials required for loading the programming interface and the corresponding relationship between the materials and the roles; the first intermediate state file is a description file of the programming interface; decompressing the project file based on a preset decompression library to determine the resource file; deserializing and parsing the resource file according to the first intermediate state file to generate a second intermediate state file; wherein the second intermediate state file is the resource on which the loading of the programming interface depends; determining the mapping relationship between the roles and the resources in the programming interface based on the first intermediate state file and the second intermediate state file; generating a third intermediate state file according to the mapping relationship and the second intermediate state file; The loading module is used to obtain the third intermediate state file when detecting the programming interface entry instruction, render the programming interface according to the third intermediate state file, and display the programming interface on the display of the electronic device.
7. An electronic device, characterized in that: include: Processors, communication interfaces, memories, and buses; The processor and the memory communicate with each other via the bus; The communication interface is used to communicate signals or data with other node devices; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the programming interface loading method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that: The computer readable storage medium Computer program instructions are stored on the computer, and the computer program instructions are read and executed by the computer. Execute the programming interface loading method as described in any one of claims 1 to 5.
