CN116302196A - Application running method and device based on dependency package, electronic equipment and storage medium - Google Patents

Application running method and device based on dependency package, electronic equipment and storage medium Download PDF

Info

Publication number
CN116302196A
CN116302196A CN202310280405.4A CN202310280405A CN116302196A CN 116302196 A CN116302196 A CN 116302196A CN 202310280405 A CN202310280405 A CN 202310280405A CN 116302196 A CN116302196 A CN 116302196A
Authority
CN
China
Prior art keywords
package
dependent
application
dependency
loaded
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310280405.4A
Other languages
Chinese (zh)
Inventor
张英楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310280405.4A priority Critical patent/CN116302196A/en
Publication of CN116302196A publication Critical patent/CN116302196A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides an application running method, device, electronic equipment and storage medium based on a dependency package. The method is applied to terminal equipment, wherein a browser is deployed in the terminal equipment, and at least one application is aggregated in the browser; comprising the following steps: responding to an application running instruction, and acquiring a preset dependent configuration file from a preset storage position of a browser; wherein, the dependency configuration file comprises attribute information of a dependency package required by running an application; the attribute information comprises an identification of a dependent package and the number of times of being loaded; acquiring a dependent package required by running the application according to the identification of the dependent package and the loaded times; and running the application on the browser according to the acquired dependent package. According to the method and the device for obtaining the dependent package, the dependent package is obtained according to the identification and the loaded times, all the dependent packages are not required to be loaded each time, and the application running efficiency is improved.

Description

Application running method and device based on dependency package, electronic equipment and storage medium
Technical Field
The present disclosure relates to computer technologies, and in particular, to a method and apparatus for running an application based on a dependency package, an electronic device, and a storage medium.
Background
The micro front end applies the idea of micro service to the browser end, and can aggregate a plurality of independent Web (World Wide Web) applications together to provide a unified access entry, so that the micro front end is converted into one micro front end application, and the micro front end application is formed by combining a plurality of independent Web applications.
In the prior art, a micro front-end technology is used for aggregating a plurality of applications, and when the applications are loaded and run in real time at a browser end, the applications are required to be correspondingly provided with a dependent package, and the dependent package is a program package required by normal application. There may be duplication of dependency packages required for each application, each of which is required to be loaded when the application is running. May result in a conflict of dependent package reloading and affect the running efficiency of the application.
Disclosure of Invention
The application provides a method, a device, electronic equipment and a storage medium for running an application based on a dependency package, which are used for improving the efficiency of running the application.
In a first aspect, the present application provides a method for running an application based on a dependency package, where the method is applied to a terminal device, where a browser is deployed in the terminal device, and at least one application is aggregated in the browser; the method comprises the following steps:
Responding to an application running instruction, and acquiring a preset dependent configuration file from a preset storage position of a browser; wherein, the dependency configuration file comprises attribute information of a dependency package required by running an application; the attribute information comprises an identification of a dependent package and the number of times of being loaded;
acquiring a dependent package required by running the application according to the identification of the dependent package and the loaded times;
and running the application on the browser according to the acquired dependent package.
In a second aspect, the present application provides a package-dependent application running apparatus, where the apparatus is applied to a terminal device, where a browser is deployed in the terminal device, and at least one application is aggregated in the browser; the device comprises:
the instruction response module is used for responding to the application running instruction and acquiring a preset dependent configuration file from a preset storage position of the browser; wherein, the dependency configuration file comprises attribute information of a dependency package required by running an application; the attribute information comprises an identification of a dependent package and the number of times of being loaded;
the dependence package acquisition module is used for acquiring the dependence package required by running the application according to the identification and the loaded times of the dependence package;
And the application running module is used for running the application on the browser according to the acquired dependency package.
In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored by the memory to implement the dependency package based application execution method as described in the first aspect of the present application.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions for implementing a method of running a packet-dependent application as described in the first aspect of the present application when executed by a processor.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the method of running a dependency-packet-based application as described in the first aspect of the present application.
The application provides an application running method, an application running device, electronic equipment and a storage medium based on a dependency package, wherein after an application running instruction is responded, a preset dependency configuration file is obtained from a browser, so that attribute information of the dependency package required by running the application is obtained. That is, an identification of the dependent package and the number of times it is loaded may be obtained, and the identification of the dependent package may represent the number of times the dependent package is allowed to be loaded. And acquiring the dependency package required by running the application according to the identification and the loaded times of the dependency package. The dependency package which is loaded in advance can be directly obtained, and the dependency package can be loaded at present, so that all the dependency packages are prevented from being loaded. And running the application according to the obtained dependent package. The process that all the dependent packages needed by the application need to be loaded when different applications are run in the prior art is avoided. Some dependent packages are only allowed to be loaded once, and if the dependent packages are required to run in different applications, the dependent packages need to be loaded every time, which causes a dependent package conflict. Depending on the running error after the packet conflict, the program is stopped, and the conflict needs to be manually checked and resolved, so that the running efficiency of the application is affected.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flow chart of a method for running an application based on a dependency package according to an embodiment of the present application;
FIG. 2 is a flow chart of a method for running an application based on a dependency package according to an embodiment of the present application;
FIG. 3 is a block diagram of a device for running an application based on a dependency package according to an embodiment of the present application;
FIG. 4 is a block diagram of a device for running an application based on a dependency package according to an embodiment of the present application;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present application;
fig. 6 is a block diagram of an electronic device according to an embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the following detailed description of the embodiments of the present application will be given with reference to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
In the description of this application, it should be understood that the terms "first," "second," "third," and the like are used merely to distinguish between similar objects and are not necessarily used to describe a particular order or sequence, nor should they be construed to indicate or imply relative importance. The specific meaning of the terms in this application will be understood by those of ordinary skill in the art as the case may be. Furthermore, in the description of the present application, unless otherwise indicated, "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
It should be noted that, for the sake of brevity, this specification is not exhaustive of all of the alternative embodiments, and after reading this specification, one skilled in the art will appreciate that any combination of features may constitute an alternative embodiment as long as the features do not contradict each other. The following describes each embodiment in detail.
The micro front end is a micro service-like architecture, applies the micro service concept to the browser end, can aggregate a plurality of independent Web applications together, provides a unified access entrance, is converted into a front end application aggregate, and is used as a micro front end application after aggregation. The perception of a micro front-end application to a user is a complete application, but technically consists of individual applications combined in some way.
The front-end dependency package is a program package required by normal operation of the application, and the front-end component library comprises a plurality of dependency packages which can be imported by a third party engineering. At present, a plurality of applications are aggregated by using a micro front-end technology, the applications are loaded and run in real time at a browser end, when a conflict exists in a dependent package in a component library loaded by the applications, the browser reports errors in running, program running is stopped, and abnormal blank or no-response conditions exist on a browser interface. The staff needs to manually check the conflict, manually avoid the conflict in the original application engineering, repackage the dependent package and then go online for deployment.
When an application is run, all the dependent packages required for the application need to be loaded. Some dependent packages may be loaded multiple times, and some dependent packages may be loaded only once, with the number of allowed loads of the dependent package being determined by the nature of the dependent package itself. The conflict of the dependent package may be that different applications may need the same dependent package when running, if the same dependent package is a dependent package which is only allowed to be loaded once, after one application loads the dependent package, the later running application cannot load the dependent package again, so as to cause the conflict of the dependent package. Through manual investigation, the problem solving efficiency is low, and the normal operation and user experience of the application are affected.
The application running method, device, electronic equipment and storage medium based on the dependent package aim to solve the technical problems in the prior art.
The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a method for running an application based on a dependency package according to an embodiment of the present application, where the method is applied to a terminal device, a browser is deployed in the terminal device, and at least one application is aggregated on the browser, and the method may be executed by an application running device based on the dependency package. As shown in fig. 1, the method comprises the steps of:
s101, responding to an application running instruction, and acquiring a preset dependent configuration file from a preset storage position of a browser; the dependency configuration file comprises attribute information of a dependency package required by running an application; the attribute information includes the identification of the dependent package and the number of times it is loaded.
For example, a plurality of applications may be aggregated at the browser end, for example, the applications may be information management systems designed in advance according to actual requirements, and the like. Each application corresponds to a component library, the component library comprises a dependency package required for running the application, the dependency package is a program package pre-written by a worker, and the worker can collect the written dependency package into the component library in advance. Multiple dependency packages may be used for normal operation of an application, and there may be duplication of dependency packages required for different applications. The multiple applications aggregated in the browser may also correspond to the same component library, i.e., one component library may include all the dependency packages required by each application.
A dependency configuration file may be preset, and attribute information of the dependency package may be included in the dependency configuration file, for example, the attribute information may include a name, an identifier, a number of times of being loaded, and the like of the dependency package. The number of times the dependent package is loaded is the number of times the dependent package is already loaded, for example, when the application one and the application two need to run, the application one runs first and needs to load the dependent package A, and the number of times the dependent package A is loaded can be 1; and running after the second application, and loading the dependent packet A, wherein the number of times of the dependent packet A being loaded is changed to 2. Each dependent package may have an identifier, where the identifier may be used to indicate the number of times the dependent package is allowed to be loaded, e.g., if the dependent package is allowed to be loaded only once, the identifier may be "a"; if the dependent package is allowed to be loaded multiple times, the identification may be "b". The number of times each dependent package is allowed to be loaded is determined by the nature of the dependent package itself, and a worker can determine the number of times the dependent package is allowed to be loaded when writing the dependent package. After the dependency packages are assembled into the component library, attribute information of each dependency package in the component library is acquired, and a dependency configuration file is generated. The dependency configuration file may be placed at a preset storage location, for example, the dependency configuration file may be imported onto a global object of the browser, which may be a Window object.
The user may issue an application running instruction for an application at the browser end, thereby running the application at the browser end. And if the application to be operated is determined in response to the application operation instruction, acquiring the dependency configuration file from the global object of the browser. The dependency configuration file contains attribute information of the dependency package required for running the application, so that information such as identification and loaded times of the dependency package required for running the application is obtained.
In this embodiment, obtaining a preset dependency configuration file from a preset storage location of a browser includes: if the preset storage position of the browser does not have the dependent configuration file, the dependent configuration file is imported from the preset file configuration position to the preset storage position, and the dependent configuration file is acquired from the storage position.
Specifically, after responding to an application running instruction, determining whether a dependency configuration file exists on the global object of the browser, and if so, acquiring the dependency configuration file. The dependency profile is placed on the browser global object after the first response to the application execution instruction. Thus, there is no dependency profile on the browser global object when responding to an application run instruction for the first time.
If the fact that the global object of the browser does not have the dependency configuration file is determined, the application on the browser is started for the first time, the dependency configuration file is defined on the global object of the browser, the dependency configuration file is obtained, and attribute information in the dependency configuration file is read. After the first response is made to the application running instruction, if the application running instruction is received later, the dependency configuration file can be directly obtained from the browser global object, and the dependency configuration file is not required to be defined on the browser global object.
The method has the advantages that when the application running instruction is received for the first time, the dependent configuration file is required to be placed at the preset storage position of the browser, convenience is provided for acquiring the dependent configuration file later, and the application running efficiency is improved.
In this embodiment, the method further includes: acquiring attribute information of dependent packages required by all applications aggregated in a browser; and generating a dependent configuration file based on a preset array structure according to the attribute information, and storing the dependent configuration file to a preset file configuration position.
Specifically, a dependency package pre-written by a worker is obtained, and the project of the component library is constructed and used as the component library engineering. And eliminating redundant dependent packets according to a preset dependent packet detection tool. A dependency package detection tool may be installed in the component library engineering, for example, the dependency package detection tool may be a Depcheck tool, which may detect a dependency package actually used in a project, and for an unused dependency package, the tool may automatically reject it.
And carding the reserved dependent package, reading attribute information of the dependent package, wherein the attribute information can comprise the name of the dependent package, the corresponding version of the dependent package, the identification of the dependent package and the like. The attribute information is predetermined by staff when writing the dependency package, and a dependency configuration file is added in the component library engineering according to the attribute information of the dependency package, wherein the dependency configuration file comprises the attribute information of all the dependency packages used by all applications on the browser. In the dependency configuration file, attribute information of each dependency package may be represented in a tuple structure. The array structure is preset, and attribute information in the array structure can comprise the name, the identification and the loaded times of the dependent package. The identification of the dependent package may include two types, for example, the identification of the dependent package may be "a" or "b", where a "indicates that the dependent package can be loaded only once by the browser, and" b "indicates that the dependent package can be reloaded by the browser and the program does not report an error. When the dependency configuration file is generated, the default value of the loaded times is 0, which indicates that the dependency package is not loaded yet. And placing the dependency package configuration file at a preset file configuration position, and placing the dependency configuration file on a global object of the browser when responding to the application running instruction.
The method has the advantages that the dependence configuration file is generated in advance, the attribute of each dependence package is determined in advance, the dependence package loading conflict can be avoided according to the attribute information of the dependence package when the dependence package is loaded, and the program running quality and the user experience are improved.
S102, acquiring the dependent package required by running the application according to the identification of the dependent package and the loaded times.
For example, the dependency configuration file may further include an association relationship between the application and the dependency package, and the dependency package required for running the application is determined according to the association relationship between the application and the dependency package. And determining the identification and the loaded times of the needed dependent package from the dependent configuration file, and determining whether to directly acquire the loaded dependent package or load the dependent package currently according to the identification and the loaded times of the dependent package, thereby obtaining the dependent package needed by the running application. For example, if the number of times the dependent packet is loaded is 0, it is determined that the dependent packet is the first load, and the dependent packet needs to be loaded now. For another example, the dependent package has already been loaded and does not need to be loaded again, the dependent package may be obtained directly from the location where the dependent package is located.
If the dependent package needs to be loaded, after the dependent package is loaded, the loaded times of the dependent package may be updated, for example, the loaded times may be increased by one. Different users may need to use the same dependency package, regardless of which application, the number of times the dependency package is loaded needs to be updated whenever the dependency package is loaded.
S103, running the application on the browser according to the acquired dependent package.
By way of example, the dependency package includes code for running functions in the application, and by running the dependency package, the application program can be loaded and run normally in the browser. For example, the browser side includes a main application and a sub application, the dependency package required by the main application and the sub application is the same, and the dependency package can be loaded only once. When the browser accesses the main application, the dependency package required by the main application is loaded for the first time, and the main application operates normally; and triggering the activation condition of the sub-application in the micro front end framework, wherein the dependent package is not loaded for the first time, and in order to avoid conflict, the dependent package is not loaded, and the sub-application directly acquires the loaded dependent package, namely shares the same dependent package with the main application, and the sub-application runs normally.
The embodiment of the application provides an application running method based on a dependency package, and after an application running instruction is responded, a preset dependency configuration file is obtained from a browser, so that attribute information of the dependency package required by running the application is obtained. That is, an identification of the dependent package and the number of times it is loaded may be obtained, and the identification of the dependent package may represent the number of times the dependent package is allowed to be loaded. And acquiring the dependency package required by running the application according to the identification and the loaded times of the dependency package. The dependency package which is loaded in advance can be directly obtained, and the dependency package can be loaded at present, so that all the dependency packages are prevented from being loaded. And running the application according to the obtained dependent package. The process that all the dependent packages needed by the application need to be loaded when different applications are run in the prior art is avoided. Some dependent packages are only allowed to be loaded once, and if the dependent packages are required to run in different applications, the dependent packages need to be loaded every time, which causes a dependent package conflict. Depending on the running error after the packet conflict, the program is stopped, and the conflict needs to be manually checked and resolved, so that the running efficiency of the application is affected.
Fig. 2 is a schematic flow chart of a method for running an application based on a dependency package according to an embodiment of the present application, where the embodiment is an alternative embodiment based on the foregoing embodiment.
In this embodiment, the dependency configuration file includes the name of the dependency package; according to the identification and the loaded times of the dependent package, the dependent package required by the running application is acquired, and can be refined as follows: if the identification of the dependent packet is a preset first identification, determining the loaded times of the dependent packet; wherein the first identifier indicates that the dependent package is allowed to be loaded only once; if the number of times of the dependent package being loaded is the preset number of times of the loading, the name of the dependent package is determined, and the preloaded dependent package is obtained from a preset storage position of the browser according to the name of the dependent package.
As shown in fig. 2, the method comprises the steps of:
s201, responding to an application running instruction, and acquiring a preset dependent configuration file from a preset storage position of a browser; the dependency configuration file comprises attribute information of a dependency package required by running an application; the attribute information includes the identification of the dependent package and the number of times it is loaded.
For example, this step may refer to step S101, and will not be described in detail.
S202, if the identification of the dependent packet is a preset first identification, determining the loaded times of the dependent packet; wherein the first identification indicates that the dependent package is allowed to be loaded only once.
Illustratively, the identification of the dependent package is preset, and the identification of the dependent package may include a first identification and a second identification. The first identifier may indicate that the dependent package is allowed to be loaded only once and the second identifier may indicate that the dependent package is allowed to be loaded multiple times. That is, if the identifier of the dependent package is the first identifier, the dependent package can only be loaded once when being loaded for the first time on the browser; if the identifier of the dependent package is the second identifier, loading the dependent package when different applications corresponding to the dependent package run on the browser. If the dependent package which is only allowed to be loaded once is loaded for a plurality of times, a fault is generated, and the running of the application is stopped.
And determining a dependency package corresponding to the application running instruction, and acquiring the identification of the dependency package from the dependency configuration file. If the identification of the dependent packet is a preset first identification, determining the loaded times corresponding to the dependent packet. For the first identified dependent packet, the number of times it is loaded can only be 0 or 1, i.e., the dependency Bao Yaome is not loaded or is loaded once. If the dependent package needs to be used again after being loaded once, the dependent package cannot be loaded again. A number of loads is preset, for example, the preset number of loads is 1. If the number of times the dependent packet is loaded is a preset number of times, that is, the number of times the dependent packet is loaded is 1, it is indicated that the dependent packet has been loaded. Since the dependent package can only be loaded once, it is not necessary to load the dependent package again.
In this embodiment, obtaining the dependency package required for running the application according to the identifier of the dependency package and the loaded times includes: if the identification of the dependent package is a preset second identification, determining the name of the dependent package, and acquiring the dependent package from a preset component library corresponding to the application according to the name of the dependent package for loading; wherein the second identification indicates that the dependent package is allowed to be loaded multiple times.
Specifically, if the identifier of the dependent package is the preset second identifier, it is determined that the dependent package may be loaded multiple times, that is, the dependent package is loaded each time an application requiring the dependent package is run. Thus, there may be no need to pay attention to the number of times the dependent packet is loaded. The dependency configuration file also includes the names of the dependency packages, and each dependency package corresponds to a unique dependency package name. The name of the dependent package may be determined directly as long as the identity of the dependent package is the second identity. Each application has a component library that includes all the dependency packages required for the application. And acquiring the dependency package from the component library corresponding to the application according to the name of the dependency package. The dependency package is loaded, and the dependency package can be loaded on a global object of an application, so that the application is used in the running process.
For the second identified dependent package, each application needs to be loaded separately at the time of use. Thus, there is no need to place the loaded dependency package on the browser global object. For the first identified dependency package, different applications may share the dependency package, and thus, the first identified dependency package needs to be placed on the browser global object, so as to facilitate sharing of the dependency package.
The method has the advantages that if the dependent package identifier is the second identifier, the dependent package conflict cannot be generated during multiple times of loading, the dependent packages of the second identifiers of the applications can be the same or different, namely, the applications can load the dependent packages required by the applications, and the actual requirements of the applications are met.
S203, if the number of times the dependent package is loaded is the preset number of times, determining the name of the dependent package, and acquiring the preloaded dependent package from the preset storage position of the browser according to the name of the dependent package.
Illustratively, after determining that the identifier of the dependent package is a preset first identifier and the number of times the dependent package is loaded is a preset number of loads, determining the name of the dependent package. The dependency package has been loaded on a preset storage location of the browser after the first load, e.g. has been present on the browser global object. The preloaded dependent package is obtained from the global object of the browser according to the name of the dependent package. By determining that the dependent package is the first identification and the loaded times are 1, the situation that the dependent package can collide during loading can be prejudged in advance, so that the dependent package collision is avoided, and the program running quality and the user experience are improved.
In this embodiment, if the number of times the dependent packet is loaded is a preset number of loads, obtaining the preloaded dependent packet from the preset location includes: if the number of times of the dependent package loaded is not the preset number of times of the loading, determining the name of the dependent package, and acquiring the dependent package from a preset component library corresponding to the application according to the name of the dependent package to load; wherein, the component library comprises all the dependent packages required by running the application; and placing the loaded dependent package at a preset storage position of the browser.
Specifically, if the identifier of the dependent packet is the first identifier, but the number of times of being loaded is not the preset number of times of being loaded, that is, the number of times of being loaded is 0, it is determined that the dependent packet is not yet loaded, and at this time, the first loading is required. And determining the name of the dependent package, and acquiring the dependent package from a component library corresponding to the application according to the name of the dependent package for loading. The dependency package may be loaded onto the browser global object, i.e., the loaded dependency package is placed at a preset storage location of the browser.
For the first loaded first identified dependent package, the dependent package exists on the browser global object, so that the dependent package can be directly obtained from the browser global object when the application needs the dependent package later. That is, the dependency package is loaded only once on the browser.
The method has the advantages that if the dependent package can only be loaded once, the dependent package is normally loaded when the dependent package is loaded for the first time. When the dependent package is not loaded for the first time, the loading of the dependent package is skipped, and each application shares the dependent package, so that the conflict generated during the loading of the dependent package is avoided, and the running efficiency of the application is improved.
In this embodiment, after obtaining the dependency package from the preset component library corresponding to the application for loading, the method further includes: and adding one to the loaded times of the dependent package in the dependent configuration file.
Specifically, if the dependent packet is the first identifier and the loaded frequency is 1, after the dependent packet is acquired, since the dependent packet is not loaded, the loaded frequency of the dependent packet does not need to be changed, and the loaded frequency is still 1; if the dependent packet is the first identifier and the loaded time is 0, the dependent packet is loaded for the first time, the loaded time needs to be updated after loading, and the loaded time can be increased by one, namely the loaded time becomes 1; if the dependent packet is the second identifier, the current loaded times can be increased by one after each loading no matter how many times the dependent packet is loaded before loading, that is, the loaded times of the dependent packet are updated for each loading of the dependent packet of the second identifier. The method realizes the real-time update of the loaded times, is convenient for the subsequent determination of whether the dependent packet needs to be loaded, avoids the conflict caused by the loading error of the dependent packet, and effectively improves the efficiency of the application operation.
S204, running the application on the browser according to the acquired dependent package.
For example, this step may refer to step S103, and will not be described in detail.
The embodiment of the application provides an application running method based on a dependency package, and after an application running instruction is responded, a preset dependency configuration file is obtained from a browser, so that attribute information of the dependency package required by running the application is obtained. That is, an identification of the dependent package and the number of times it is loaded may be obtained, and the identification of the dependent package may represent the number of times the dependent package is allowed to be loaded. And acquiring the dependency package required by running the application according to the identification and the loaded times of the dependency package. The dependency package which is loaded in advance can be directly obtained, and the dependency package can be loaded at present, so that all the dependency packages are prevented from being loaded. And running the application according to the obtained dependent package. The process that all the dependent packages needed by the application need to be loaded when different applications are run in the prior art is avoided. Some dependent packages are only allowed to be loaded once, and if the dependent packages are required to run in different applications, the dependent packages need to be loaded every time, which causes a dependent package conflict. Depending on the running error after the packet conflict, the program is stopped, and the conflict needs to be manually checked and resolved, so that the running efficiency of the application is affected.
Fig. 3 is a block diagram of a device for running an application based on a dependency package according to an embodiment of the present application, where the device is applied to a terminal device, a browser is deployed in the terminal device, and at least one application is aggregated on the browser. For ease of illustration, only portions relevant to embodiments of the present disclosure are shown. Referring to fig. 3, the apparatus includes: instruction response module 301, dependency package acquisition module 302 and application execution module 303.
The instruction response module 301 is configured to obtain a preset dependency configuration file from a preset storage location of the browser in response to an application running instruction; wherein, the dependency configuration file comprises attribute information of a dependency package required by running an application; the attribute information comprises an identification of a dependent package and the number of times of being loaded;
a dependency package obtaining module 302, configured to obtain a dependency package required for running the application according to the identifier and the loaded times of the dependency package;
and the application running module 303 is used for running the application on the browser according to the acquired dependency package.
Fig. 4 is a structural block diagram of an application running device based on a dependency package according to an embodiment of the present application, where a dependency configuration file includes a name of the dependency package. On the basis of the embodiment shown in fig. 3, as shown in fig. 4, the dependent packet acquisition module 302 includes a number acquisition unit 3021 and a dependent packet acquisition unit 3022.
A number acquisition unit 3021, configured to determine the number of times the dependent packet is loaded if the identifier of the dependent packet is a preset first identifier; wherein the first identifier indicates that the dependent package is allowed to be loaded only once;
the dependency package obtaining unit 3022 is configured to determine a name of the dependency package if the number of times the dependency package is loaded is a preset number of times, and obtain, according to the name of the dependency package, the dependency package that is preloaded from a preset storage location of the browser.
In one example, the dependency package fetch unit 3022 is specifically configured to:
if the number of times of the dependent package being loaded is not the preset number of times of the loading, determining the name of the dependent package, and acquiring the dependent package from a preset component library corresponding to the application according to the name of the dependent package to load; wherein the component library comprises all dependency packages required for running the application;
and placing the loaded dependent package at a preset storage position of the browser.
In one example, the dependency package retrieval module 302 includes:
a dependent package loading unit, configured to determine a name of the dependent package if the identifier of the dependent package is a preset second identifier, and acquire the dependent package from a preset component library corresponding to the application according to the name of the dependent package for loading; wherein the second identification indicates that the dependent package is allowed to be loaded multiple times.
In one example, the apparatus further comprises:
and the frequency updating module is used for adding one to the loaded frequency of the dependent package in the dependent configuration file after the dependent package is obtained from the preset component library corresponding to the application and loaded.
In one example, instruction response module 301 is specifically configured to:
if the dependency configuration file does not exist in the preset storage position of the browser, importing the dependency configuration file from the preset file configuration position to the preset storage position, and acquiring the dependency configuration file from the storage position.
In one example, the apparatus further comprises:
the attribute acquisition module is used for acquiring attribute information of the dependent package required by all applications aggregated in the browser;
and the file generation module is used for generating the dependent configuration file based on a preset array structure according to the attribute information and storing the dependent configuration file to a preset file configuration position.
Fig. 5 is a block diagram of an electronic device according to an embodiment of the present application, where, as shown in fig. 5, the electronic device includes: a memory 51, a processor 52; memory 51, a memory for storing instructions executable by processor 52.
Wherein the processor 52 is configured to perform the method as provided by the above-described embodiments.
The electronic device further comprises a receiver 53 and a transmitter 54. The receiver 53 is configured to receive instructions and data transmitted from other devices, and the transmitter 54 is configured to transmit instructions and data to external devices.
Fig. 6 is a block diagram of an electronic device, which may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like, in accordance with an exemplary embodiment.
The device 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an input/output (I/O) interface 612, a sensor component 614, and a communication component 616.
The processing component 602 generally controls overall operation of the device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operations at the device 600. Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, and the like. The memory 604 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 606 provides power to the various components of the device 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 600.
The multimedia component 608 includes a screen between the device 600 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and/or a rear camera. The front-facing camera and/or the rear-facing camera may receive external multimedia data when the device 600 is in an operational mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 610 is configured to output and/or input audio signals. For example, the audio component 610 includes a Microphone (MIC) configured to receive external audio signals when the device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 614 includes one or more sensors for providing status assessment of various aspects of the device 600. For example, the sensor assembly 614 may detect the on/off state of the device 600, the relative positioning of the components, such as the display and keypad of the device 600, the sensor assembly 614 may also detect a change in position of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, the orientation or acceleration/deceleration of the device 600, and a change in temperature of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communication between the device 600 and other devices, either wired or wireless. The device 600 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In one exemplary embodiment, the communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 604, including instructions executable by processor 620 of device 600 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of a terminal device, causes the terminal device to perform the above-described method of running a packet-dependent application of the terminal device.
The application also discloses a computer program product comprising a computer program which, when executed by a processor, implements a method as described in the present embodiment.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present application may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or electronic device.
In the context of this application, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data electronic device), or that includes a middleware component (e.g., an application electronic device), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and an electronic device. The client and the electronic device are generally remote from each other and typically interact through a communication network. The relationship of client and electronic devices arises by virtue of computer programs running on the respective computers and having a client-electronic device relationship to each other. The electronic equipment can be cloud electronic equipment, also called cloud computing electronic equipment or cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service (Virtual Private Server or VPS for short) are overcome. The electronic device may also be an electronic device of a distributed system or an electronic device that incorporates a blockchain. It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, provided that the desired results of the technical solutions disclosed in the present application can be achieved, and are not limited herein.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (11)

1. The application running method based on the dependent package is characterized in that the method is applied to terminal equipment, a browser is deployed in the terminal equipment, and at least one application is aggregated in the browser; the method comprises the following steps:
responding to an application running instruction, and acquiring a preset dependent configuration file from a preset storage position of a browser; wherein, the dependency configuration file comprises attribute information of a dependency package required by running an application; the attribute information comprises an identification of a dependent package and the number of times of being loaded;
acquiring a dependent package required by running the application according to the identification of the dependent package and the loaded times;
and running the application on the browser according to the acquired dependent package.
2. The method of claim 1, wherein the dependency configuration file includes a name of the dependency package;
obtaining the dependency package required by running the application according to the identification and the loaded times of the dependency package, wherein the method comprises the following steps:
If the identification of the dependent packet is a preset first identification, determining the loaded times of the dependent packet; wherein the first identifier indicates that the dependent package is allowed to be loaded only once;
if the number of times of the dependent package being loaded is the preset number of times of the loading, determining the name of the dependent package, and acquiring the preloaded dependent package from a preset storage position of the browser according to the name of the dependent package.
3. The method of claim 2, wherein if the number of times the dependent packet is loaded is a preset number of loads, obtaining the preloaded dependent packet from the preset location comprises:
if the number of times of the dependent package being loaded is not the preset number of times of the loading, determining the name of the dependent package, and acquiring the dependent package from a preset component library corresponding to the application according to the name of the dependent package to load; wherein the component library comprises all dependency packages required for running the application;
and placing the loaded dependent package at a preset storage position of the browser.
4. The method of claim 2, wherein obtaining the dependency package required to run the application based on the identification of the dependency package and the number of loads, comprises:
If the identification of the dependent package is a preset second identification, determining the name of the dependent package, and acquiring the dependent package from a preset component library corresponding to the application according to the name of the dependent package for loading; wherein the second identification indicates that the dependent package is allowed to be loaded multiple times.
5. The method according to claim 3 or 4, further comprising, after obtaining the dependency package from a preset component library corresponding to the application for loading, the steps of:
and adding one to the loaded times of the dependent package in the dependent configuration file.
6. The method of claim 1, wherein retrieving the preset dependent profile from the preset storage location of the browser comprises:
if the dependency configuration file does not exist in the preset storage position of the browser, importing the dependency configuration file from the preset file configuration position to the preset storage position, and acquiring the dependency configuration file from the storage position.
7. The method of claim 6, wherein the method further comprises:
acquiring attribute information of dependent packages required by all applications aggregated in the browser;
And generating the dependency configuration file based on a preset array structure according to the attribute information, and storing the dependency configuration file to a preset file configuration position.
8. The application running device based on the dependent package is characterized in that the device is applied to terminal equipment, a browser is deployed in the terminal equipment, and at least one application is aggregated in the browser; the device comprises:
the instruction response module is used for responding to the application running instruction and acquiring a preset dependent configuration file from a preset storage position of the browser; wherein, the dependency configuration file comprises attribute information of a dependency package required by running an application; the attribute information comprises an identification of a dependent package and the number of times of being loaded;
the dependence package acquisition module is used for acquiring the dependence package required by running the application according to the identification and the loaded times of the dependence package;
and the application running module is used for running the application on the browser according to the acquired dependency package.
9. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
The processor executes the computer-executable instructions stored by the memory to implement the dependency-packet-based application run method as recited in any one of claims 1-7.
10. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are for implementing the dependency package based application run method as claimed in any one of claims 1 to 7.
11. A computer program product comprising a computer program which, when executed by a processor, implements the dependency-packet-based application running method of any one of claims 1 to 7.
CN202310280405.4A 2023-03-21 2023-03-21 Application running method and device based on dependency package, electronic equipment and storage medium Pending CN116302196A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310280405.4A CN116302196A (en) 2023-03-21 2023-03-21 Application running method and device based on dependency package, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310280405.4A CN116302196A (en) 2023-03-21 2023-03-21 Application running method and device based on dependency package, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116302196A true CN116302196A (en) 2023-06-23

Family

ID=86825406

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310280405.4A Pending CN116302196A (en) 2023-03-21 2023-03-21 Application running method and device based on dependency package, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116302196A (en)

Similar Documents

Publication Publication Date Title
CN110650129B (en) Account login method and device and computer readable storage medium
CN109684112B (en) Program file operation method, device, terminal and storage medium
CN113778687B (en) Memory allocation information processing method and device, electronic equipment and storage medium
CN113467854B (en) Application program starting method and device, electronic equipment and storage medium
CN116302196A (en) Application running method and device based on dependency package, electronic equipment and storage medium
CN107257384B (en) Service state monitoring method and device
CN115002227B (en) User access request response method, storage medium and electronic device
CN116600011A (en) Data information acquisition method, device, equipment and storage medium
CN115665224A (en) Data transmission method, device and equipment based on cloud data warehouse and storage medium
CN111382237B (en) Data processing method, device and task dialogue system
CN111767249B (en) Method and device for determining self-running time of function
CN115509580A (en) Data request access method, device, equipment and storage medium
CN116248781A (en) Message processing method, device, equipment and storage medium based on transaction information
CN117472931A (en) Method, device, equipment and storage medium for calling database execution statement
CN116257160A (en) Sub-application configuration method, device and equipment under micro front end framework and storage medium
CN116321363A (en) Communication method, device, equipment and storage medium based on long-distance radio
CN118283203A (en) Video data complement method and device, electronic equipment and storage medium
CN115811806A (en) Bluetooth connection method and device, electronic equipment and storage medium
CN114721819A (en) Method, device and equipment for processing to-be-processed service and storage medium
CN117061583A (en) Message data information processing method, device, equipment and storage medium
CN116431673A (en) Data information query method, device, equipment and storage medium
CN117093486A (en) Interface testing method, device, equipment and storage medium
CN116909775A (en) Data information calling method, device, equipment and storage medium
CN114240393A (en) Data processing method, device and equipment based on management system and storage medium
CN116708671A (en) Customer service system routing node determining method, equipment and storage medium

Legal Events

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