Methods, apparatuses, devices, and media for introducing components to applications
By developing dedicated components for each application and searching and updating the import operations in the component resource library, the problem of large storage space and transmission bandwidth requirements in the existing technology is solved, thereby improving application performance and component import efficiency.
Patent Information
- Application Number
- CN202210887695.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-26
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-07-26
AI Technical Summary
Existing technologies have problems with large storage space and transmission bandwidth requirements when introducing components into applications, and poor application performance due to the inclusion of redundant code resources in integrated components.
Develop separate code and generate dedicated components for each application. By defining the import operation in the application definition, obtain the import mode, search for the corresponding component resources in the component resource library, and update the import operation to import the dedicated component resources into the application.
It reduces storage space and transmission bandwidth overhead during component introduction, and improves application performance and the efficiency of component introduction.
Smart Images

Figure CN115167945B_ABST
Abstract
Description
Technical Field
[0001] The exemplary implementations of this disclosure generally relate to the field of software development, and in particular to methods, apparatus, devices, and computer-readable storage media for introducing components into an application. Background Technology
[0002] With the development of component technology, application functions can be refined, and various aspects of an application's functionality can be implemented based on components. When multiple applications have similar functions, these similar functions can be integrated into a single component. In this case, the integrated component includes code resources used to implement the functions of multiple applications. This results in a large demand for storage space and transmission bandwidth when introducing components into various applications, and the application performance is also unsatisfactory due to the redundant code resources included in the integrated component. Therefore, how to introduce components into applications in a simpler and more efficient way has become a research hotspot and challenge in the field of software development. Summary of the Invention
[0003] In a first aspect of this disclosure, a method for introducing a component into an application is provided. In this method, an introduction operation is determined in the application's definition, the introduction operation indicating the component to be introduced into the application. An introduction mode for introducing the component into the application is obtained, the introduction mode including any of the following: offline introduction mode and online introduction mode. In a component resource library associated with the application, a component resource corresponding to the component is located according to the introduction mode. Using the address of the component resource in the component resource library, the introduction operation in the definition is updated to introduce the component resource corresponding to the component into the application.
[0004] In a second aspect of this disclosure, an apparatus for introducing a component into an application is provided. The apparatus includes: a determining module configured to determine an introduction operation in the application's definition, the introduction operation indicating a component to be introduced into the application; an obtaining module configured to obtain an introduction mode for introducing the component into the application, the introduction mode including any one of: an offline introduction mode and an online introduction mode; a searching module configured to search for a component resource corresponding to the component in a component resource library associated with the application, based on the introduction mode; and an updating module configured to update the introduction operation in the definition using the address of the component resource in the component resource library, for introducing the component resource corresponding to the component into the application.
[0005] In a third aspect of this disclosure, an electronic device is provided. The electronic device includes: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the device to perform a method according to a first aspect of this disclosure when executed by the at least one processing unit.
[0006] In a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, causes the processor to implement the method according to a first aspect of this disclosure.
[0007] It should be understood that the content described in the summary section of this invention is not intended to limit the key or essential features of the implementation of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0008] The above and other features, advantages, and aspects of various implementations of this disclosure will become more apparent in the following detailed description, taken in conjunction with the accompanying drawings. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0009] Figure 1 A block diagram of an example environment in which the implementation of this disclosure can be implemented is shown;
[0010] Figure 2 A block diagram is shown illustrating a process for introducing components into an application according to some implementations of this disclosure;
[0011] Figure 3 A block diagram is shown illustrating a process for updating an introduction operation according to some implementations of this disclosure;
[0012] Figure 4 A block diagram illustrating a multi-level directory structure of a component repository according to some implementations of this disclosure is shown;
[0013] Figure 5 A block diagram is shown illustrating a process for determining the address of a component resource in a component resource library according to some implementations of this disclosure;
[0014] Figure 6 A block diagram is shown illustrating the process of updating the import operation based on an offline import mode according to some implementations of this disclosure;
[0015] Figure 7 A block diagram is shown illustrating a process for updating an import operation based on an online import pattern according to some implementations of this disclosure;
[0016] Figure 8 A flowchart is shown illustrating a method for introducing components into an application according to some implementations of this disclosure;
[0017] Figure 9 A block diagram of an apparatus for introducing components into an application according to some implementations of this disclosure is shown; and
[0018] Figure 10A block diagram of a device capable of implementing various implementations of the present disclosure is shown. Detailed Implementation
[0019] Implementations of this disclosure will now be described in more detail with reference to the accompanying drawings. While some implementations of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the implementations set forth herein. Rather, these implementations are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and implementations of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0020] In the description of the implementation methods disclosed herein, the term "comprising" and similar terms should be understood as open inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one implementation" or "the implementation" should be understood as "at least one implementation". The term "some implementations" should be understood as "at least some implementations". Other explicit and implicit definitions may also be included below. As used herein, the term "model" can represent the relationships between various data. For example, the aforementioned relationships can be obtained based on various currently known and / or future-developed technical solutions.
[0021] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0022] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure through appropriate means in accordance with relevant laws and regulations, and user authorization should be obtained.
[0023] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0024] As an optional but non-restrictive implementation, in response to a user's active request, a prompt message can be sent to the user, for example, via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose whether to "agree" or "disagree" to provide personal information to the electronic device.
[0025] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0026] Example Environment
[0027] Typically, developers can create multiple applications, each potentially offering its own unique features. For example, both news apps and video apps can provide content related to sports events. News apps can offer live scores, text, and images of sports events, while video apps can offer live scores and videos of sports events.
[0028] First see Figure 1 Describe the application environment of the components that manage the application. Figure 1 A block diagram of an example environment 100 in which the implementation of this disclosure can be implemented is shown. For example... Figure 1 As shown, multiple applications 110 and 120 can be provided. Specifically, applications 110 and 120 can each include "Sports" components 116 and 126, respectively, and both components can provide news about basketball events. For example, content area 112 in component 116 can include live text updates of the basketball event, score area 114 can include the scores of the two participating teams, and so on. Furthermore, content area 122 in component 126 can include live video updates of the basketball final, score area 124 can include the scores of the two participating teams, and so on.
[0029] In the context of this disclosure, a component can represent a software module that provides specific functionality in an application. Specifically, a component can present content obtained according to specific page logic in a specific page style (e.g., a presentation style related to the appearance of the application's user interface, including background color, text color, font, font size, size and layout of various elements on the page, etc.).
[0030] To facilitate component management, code resources applicable to various applications can be integrated into a single component for maintenance. In other words, all applications use the same component, i.e., the integrated component. When introducing the integrated component into various applications, the same import operation can be added to the definition of each application to include the integrated component. For example... Figure 1 As shown, for the "Sports" component, an integration component 130 can be provided, which may include component resources 132 for application 110 and component resources 134 for application 120. Furthermore, corresponding integration components can also be provided for other components; for example, an integrated music component can be provided for the "Music" component, and so on.
[0031] When importing components into applications 110 and 120, it is not necessary to distinguish between component resources 132 and 134 used in each application. Instead, a unified import operation 140 can be used to import the integrated component 130. For example, the following import operations can be used to import the "Sports" component and the "Music" component into applications 110 and 120 respectively: Import...'sport-comp' and Import...music-comp'. Although the integrated management method facilitates global management, the integrated component includes redundant code for multiple applications, which makes the component bulky and inefficient. Furthermore, importing components into each application requires a large amount of storage space and transmission bandwidth.
[0032] To reduce code redundancy, separate code and dedicated components can be developed for each application. In this case, only one or more components specifically developed for that application are introduced into a given application. For example, for the "Sports" component, there would be a component version specifically developed for application 110 and a component version specifically developed for application 120. It's understood that applications may involve numerous components such as sports, music, and movies. Therefore, how to introduce the required components to each application in a more convenient and efficient way becomes a pressing issue.
[0033] Summary of component introduction
[0034] To address the shortcomings of the aforementioned technical solutions, this disclosure proposes a technical solution for introducing components into applications, based on an exemplary implementation. During component development, code can be developed separately for each application, generating corresponding components. However, when introducing these components into different applications, the same introduction operation cannot be used; instead, a separate introduction operation needs to be defined for each application. This approach, by developing and introducing separate components for each application, significantly reduces component redundancy, thereby reducing overhead in terms of storage space and transmission bandwidth.
[0035] See below. Figure 2 Describe an overview of the components being introduced into the application. Figure 2 A block diagram 200 illustrates a process for introducing components into an application according to some implementations of this disclosure. For example... Figure 2As shown, separate components can be developed for applications 110 and 120, and each component can have its own component resources. Specifically, for the "Sports" component, the component developed for application 110 may include component resource 210, and the component developed for application 120 may include component resource 220, and so on. Component resources for different applications can be stored in the component resource library 230. When an application involves multiple components, the component resource library 230 may include more component resources; for example, the component resource library 230 may also include component resources for components such as the "Music" component and the "Movie" component.
[0036] It will be understood that each application can have its own definition, which can specify which component(s)(s) should be included in the application. According to an exemplary implementation of this disclosure, which components to be imported into the application can be determined from the application's definition. For example, the import operation can be determined in the definition based on the keyword "import," thereby determining the components to be imported. Figure 2 As shown, for applications 110 and 120, it can be determined based on the import operation 140 that it is expected to import the "sports" component "sport-comp" and the "music" component "music-comp" into the two applications respectively.
[0037] Furthermore, the import mode (e.g., offline import mode, online import mode) used to import components into the application can be obtained. Then, in the component resource library 230, the component resource corresponding to that component can be found based on the import mode. Furthermore, the address of the component resource in the component resource library 230 can be used to update the defined import operation 140 to import the component resource corresponding to the specific component into the application. For example... Figure 2 As shown, an updated import operation 250 can be generated for application 110, and an updated import operation 252 can be generated for application 120.
[0038] Assuming component resource 210 has the address "address1" in component resource library 230, this address can be appended after the component identifier "sport-comp" in the original statement of import operation 140. For example, the relevant part of import operation 140 can be updated to: Import...'sport-comp / address1'. As another example, assuming the component resource for the "music" component used in application 110 has the address "address2" in component resource library 230, this address can be appended after the component identifier "music-comp" in the original statement of import operation 140. For example, the relevant part of import operation 140 can be updated to: Import...music-comp / address2'.
[0039] For application 120, a similar process can be performed. In this case, the addresses of the corresponding component resources in the component resource library 230, "address3" and "address4", can be added after the component identifiers "sport-comp" and "music-comp" in the original statement of import operation 140, respectively, to form an updated import operation 252. In this way, the component resources 220 of the "Sports" component and the component resources of the "Music" component, specifically developed for application 120, can be imported into application 120.
[0040] It will be understood that the components described herein are dedicated components developed for each application. Compared to regular integrated components, dedicated components implement specific functionalities within a particular application and therefore do not include redundant code. Using the exemplary implementation of this disclosure, desired dedicated components can be introduced into a desired application based on a desired introduction pattern. In this way, components can be introduced into the application automatically, thereby reducing the complexity of manual operations during component introduction, while also reducing the associated storage resource and transmission bandwidth overhead and improving application performance.
[0041] The specific implementation of component introduction
[0042] The above has provided an overview of how components are introduced into an application. The following will describe in more detail the process of component introduction. Figure 3 A block diagram 300 illustrates a process for updating an introduction operation according to some implementations of this disclosure. For example... Figure 3 As shown, an import configuration 310 can be provided to describe information related to the component import process. Import configuration 310 can specify which application(s) to import the component and specify a specific import mode. For example, import configuration 310 can specify which application(s) to import the component. For example, the keyword "output_client" can indicate one or more applications. In this case, import configuration 310 can indicate that the respective components are imported into application 110 (identified as "app1") and application 120 (identified as "app2"), respectively.
[0043] According to one exemplary implementation of this disclosure, multiple applications can be software applications that implement different functions, such as application 110 for providing news services and application 120 for providing video services described above. In the context of this disclosure, the operating system on which each application is based is not limited; for example, application 110 and application 120 can be applications developed based on the same or different operating systems. According to one exemplary implementation of this disclosure, multiple applications can be software applications developed based on different operating systems to implement the same function. For example, two applications can be applications developed based on different operating systems to provide video services.
[0044] According to an exemplary implementation of this disclosure, the import configuration 310 may include the keyword "project_mode" to indicate the import mode, such as offline import mode or online import mode. The application-based release mode can have both offline and online import modes. Here, the release mode is defined based on the application's development architecture and may include a split-end offline mode and a unified URL (Uniform Resource Locator) mode. Specifically, the split-end offline mode is typically implemented in an offline rendering framework, which can provide high rendering efficiency but has a relatively high cost. To improve rendering performance, offline resource packages can typically be deployed locally on different applications, and the corresponding resources are fetched when the user starts the application. When the user switches to a specific scene, resources can be fetched locally to achieve high-speed rendering. For applications developed based on the split-end offline mode, components can be imported into the application based on the offline import mode.
[0045] Alternatively and / or additionally, a unified URL pattern can be used in web scenarios. Under the unified URL pattern, applications are directed to the same URL during runtime; that is, all applications use the same URL address and the bound system web view to perform the rendering process. In this case, only the front-end needs to deploy the corresponding component resources on the server, and all applications can access the page providing the corresponding service using this URL. In applications developed based on the unified URL, components can be imported into the application using an online import pattern.
[0046] Will understand, Figure 3The import configuration 310 shown is merely an example format illustrating specific information used to define the import process. According to one exemplary implementation of this disclosure, the import process can be described based on other formats. For example, the import configuration can be provided based on tables or lists with different formats. In the context of this disclosure, all components invoked by the application can be imported into the application. Alternatively and / or additionally, a subset of components can be imported into the application. Specifically, the import configuration 310 can use other keywords; for example, the keyword "component" can specify the components to be imported, etc.
[0047] According to an exemplary implementation of this disclosure, the import operations in the definitions of each application can be traversed based on the import configuration 310, and then the import operations can be aligned with the specific component resources provided in the component resource library 230, thereby finding the specific address of the component resource to be imported in the component resource library 230. Subsequently, the determined specific address can be used as the entry point of the import operation, thereby importing the corresponding component resource into each application.
[0048] In the following text, the process of introducing related component resources 210 into application 110 is described using only the "Sports" component as an example. Component resources of other components (e.g., the "Music" component) can be introduced into application 110 in a similar manner. Figure 3 As shown, in the component resource library 230, the component resource corresponding to the component can be found according to the identifier of the imported component in the import operation 140 (e.g., "sport-comp"), and then the import operation 140 is updated to generate an updated import operation.
[0049] According to an exemplary implementation of this disclosure, a desired component resource can be located in the component repository 230 based on the definitions in the inclusion configuration 310. In the context of this disclosure, the component repository 230 can be a repository for storing component resources for various components to be included in various applications. Different paths within the component repository 230 can be accessed to retrieve the desired component resource. The component repository 230 can have different specific implementations in different application environments. For example, a directory structure in a file system can be used to store component resources; or, for example, component resources can be stored in a database system.
[0050] See below. Figure 4 More details about component repository 230 are described using the directory structure as a specific example. Figure 4 A block diagram 400 illustrates a multi-level directory structure of a component resource library according to some implementations of this disclosure. For example... Figure 4As shown, the component repository 230 may include a multi-level structure, and the paths may be represented based on directories. For example, a set of component directories corresponding to a set of components to be introduced into the application. For the application 110 described above, which involves a "sports" component and a "music" component, the component repository 230 may include a component directory 410 (directory name "sport-component") corresponding to the "sports" component and a component directory 420 (directory name "music-component") corresponding to the "music" component.
[0051] Furthermore, each component directory may include a type path (i.e., a lower-level directory) corresponding to the application type of the application. For example, component directory 410 may include: type directory 412 (directory name "app1") storing component resources corresponding to application 110, and type directory 414 (directory name "app2") storing component resources corresponding to application 120. The corresponding component resources may be further stored in each type directory.
[0052] It will become clear that in an application environment where code is developed separately for each application and corresponding components are generated, common and specialized parts can typically be distinguished based on the functionality of the components in each application. This allows for the output of separate components for each application based on the same component framework. In this case, for the "sports" component, multiple directories (e.g., "app1" and "app2") can be generated directly in a specified directory (e.g., "sport-component") for multiple applications, and each directory can include component resources for the specified application.
[0053] Specifically, the "sports" component can be stored in a directory named "sport-component". For example, component resources for application 110 can be stored in a directory named "app1" within this directory, and component resources for application 120 can be stored in a directory named "app2" within the same directory. Using the exemplary implementation of this disclosure, automated component import functionality can be added to the backend of an existing component development process. In this way, dedicated components developed for each application can be directly imported into the corresponding application, thereby achieving an automated component development and import process.
[0054] According to an exemplary implementation of this disclosure, component resources may include various aspects, including but not limited to framework resources, style resources, interaction resources, etc., used to implement the component. Component resources can be stored in various ways. For example, framework resources for implementing the component can be defined based on HTML (Hypertext Markup Language) format, style resources can be defined based on CSS (Cascading Style Sheets) format, and interaction resources for implementing interactive operations within the component can be defined based on JavaScript (JavaScript) format.
[0055] Alternatively and / or additionally, framework and interactive resources can be implemented using the TypeScript format. It will be understood that TypeScript is a superset of JavaScript and can be used to develop applications of all sizes for browser operation. As another example, style resources can be provided using the Leaner Style Sheet (LESS) format, a backward-compatible extension of the CSS language. Figure 4 As shown, "indexsport.ts" can provide framework resources and interactive resources, while "indexsport.less" can provide style resources.
[0056] According to one exemplary implementation of this disclosure, the components may further include third-party components. For example, Figure 4 The "package.json" file can be a third-party component provided by other providers, and this third-party component can be directly called in the "Sports" component. Using the exemplary implementation of this disclosure, various formats can be used to provide rich functionality to components, thereby enabling each component to meet the specific needs of various applications.
[0057] It will be understood that the above description of component directory 410 is only a specific example of the content of this directory, and component directory 420 can have a similar structure. For example, the directory "music-component" can further include the directories "app1" (storing "music" component resources for application 110) and "app2" (storing "music" components for application 120). When the application involves more components, component repository 230 can include other component directories for storing related resources for more components. Suppose the application further includes a "movie" component, then component repository 230 can further include the component directory "movie-component", and this component directory can further include the corresponding directories "app1" and "app2", and so on.
[0058] According to an exemplary implementation of this disclosure, the desired component resource can be located in the component repository 230 based on the import mode in the import configuration 310. Specifically, if the import mode is an offline import mode, the specific application type of the application can be determined at the time of application compilation. Here, the application type can be, for example, a news application (e.g., application 110) or a video application (e.g., application 120) as described above. Furthermore, the desired component resource can be located in the component repository 230 at the type path corresponding to the application type (e.g., various directories in the component repository). See below for more details. Figure 5 Describe more details about finding component resources.
[0059] Figure 5 A block diagram 500 illustrates a process for determining the address of a component resource in the component resource library 230, according to some implementations of this disclosure. For example... Figure 5 As shown, the "Sports" component to be imported can be searched in the component resource library 230. Specifically, the component directory 410 is used to store various versions of the "Sports" component. Assuming that application 110 is developed using a split-end offline mode, the application type can be determined at compile time, that is, application 110 used to provide news services. At this time, the type directory 412 corresponding to application 110 can be further searched in the component directory 410.
[0060] According to an exemplary implementation of this disclosure, if a component resource corresponding to the "Sports" component is found in the type directory 412, it can be determined that the desired component resource is included in the component resource library 230. At this time, the address 510 of the component resource to be imported into the application 110 can be determined based on the address of the component resource in the component resource library. Figure 5 As shown, address 510 may include the name of component directory 410, “sport-component”, and the name of type directory 412, “app1”. According to an exemplary implementation of this disclosure, if a component resource corresponding to the “sports” component is not found in component resource library 230, an alert message may be provided to indicate that an error has occurred during the component import process.
[0061] According to an exemplary implementation of this disclosure, after the address 510 of the component resource to be imported has been determined, the original import operation can be updated based on that address 510. Specifically, the component identifier corresponding to the component in the original import operation can be replaced with the address of the component resource in the component resource library. Figure 6 A block diagram 600 illustrates a process for updating an import operation based on an offline import mode, according to some implementations of this disclosure. For example... Figure 6As shown, the import operation 610 in the definition of application 110 indicates that the "sports" component is expected to be imported into application 110 from the component resource "sport-comp".
[0062] With the address 510 of the component resource "sport-comp" already determined, this address can be used to update the import operation 610. At this point, the updated import operation 620 can include the statement: Import sport from 'sport-comp / sport-component / app1'. In other words, this statement can specify that the component resource is loaded from the address "sport-comp / sport-component / app1" in the component resource library 230 to import the "sports" component into the application 110.
[0063] Using the exemplary implementation of this disclosure, when developing an application based on a distributed offline mode, the components that the application will call can be determined at compile time. Furthermore, the contents of the component resource library 230 can be automatically searched to automatically import the components to be called into the application. In this way, on the one hand, the storage space and transmission bandwidth overhead during the component import process can be reduced, and on the other hand, it can ensure that the desired components are automatically imported into the application without manual intervention.
[0064] The specific details of the update import operation have been described above. If the import operation has already been updated, an updated import operation can be performed to import component resources into the application. Specifically, the updated import operation 620 can be performed to import the "Sports" component into application 110. It will be understood that the above description of importing the "Sports" component into application 110 uses the "Sports" component as an example only. Alternatively and / or additionally, when application 110 includes more components, other components can be imported into application 110 in a similar manner. For example, a "Music" component, a "Movie" component, and so on can be imported into application 110.
[0065] According to an exemplary implementation of this disclosure, if the import mode is online import mode, it cannot be determined during compilation which application will call the component; instead, the specific application type can be determined at runtime. For example, JSBridge technology can be used to determine which application is currently calling the component. Simply put, JSBridge is a bridge between the web and the application, and it can obtain various information about the application. Specifically, front-end information can be obtained based on jsbridge.call('get-app'), that is, determining which application is currently executing (application 110 providing news services or application 120 providing video services).
[0066] Furthermore, the corresponding type directory can be searched in component directory 410 based on the application type to determine the corresponding address. Assuming application 120 is currently running, and it is desired to introduce the "Sports" component into application 120, the corresponding component resource can be searched in type directory 414. The address of the component resource to be introduced into application 120 can then be represented as... Figure 5 Address 520 in the database.
[0067] See below. Figure 7 To describe more details about the online introduction model, the Figure 7 A block diagram 700 illustrates a process for updating an import operation based on an online import mode according to some implementations of this disclosure. With the address 520 of the component resource "sport-comp" already determined, the import operation 710 can be updated using that address 520. The updated import operation 720 can then include the statement: `const sport = await import(currentApp == 'app2' ? 'sport-comp / sport-component / app2')`. In other words, this statement can specify that the component resource is loaded from the address "sport-comp / sport-component / app2" in the component resource library 230 to import the "sports" component into the application 120.
[0068] Using the exemplary implementation of this disclosure, when developing an application based on a unified URL pattern, the host (i.e., the application) of a component can be determined. Furthermore, the contents of the component repository 230 can be automatically searched to automatically import the component to be invoked into the application. Furthermore, an updated import operation 720 can be performed to import the "sports" component into the application 120. In this way, the storage space and transmission bandwidth overhead during the component import process can be reduced, and the desired component can be automatically imported into the application.
[0069] It will be understood that although only the specific process of introducing the "Sports" component into application 110 has been described above, other components, such as the "Music" component and the "Movie" component, can be introduced into application 110 in a similar manner. According to one exemplary implementation of this disclosure, one or more components can be introduced into other applications in a similar manner. For example, based on... Figure 3The import configuration 310 determines the desired components to be imported into two applications respectively. Similar methods can be used to import the corresponding components into applications 110 and 120 respectively. For example, if application 120 involves "Sports," "Music," and "TV Series" components, the corresponding component resources specifically developed for application 120 can be searched in the component resource library 230. Furthermore, based on the addresses of the found component resources in the component resource library 230, the import operation in the definition of application 120 can be updated to import the component resources of the "Sports," "Music," and "TV Series" components into application 120.
[0070] It will be understood that although the foregoing only used a file system directory structure as an example to describe a specific example of determining the address of each component resource in the component repository and updating the import operation, alternatively and / or additionally, component resources may be stored in a database system and / or in other ways. The specific address can be determined based on the specific storage environment, thereby updating the relevant parts of the import operation. Using the exemplary implementation of this disclosure, corresponding components can be imported into multiple applications in a simpler and more efficient manner. In this way, component developers can directly use applications that already include the corresponding components for debugging and testing to determine the application to be released and its corresponding one or more components.
[0071] Using the exemplary implementation of this disclosure, corresponding component introduction schemes are proposed for the two mainstream application deployment methods (distributed offline deployment and unified URL deployment) in two scenarios. In this way, a complete application environment can be provided in both application scenarios, introducing only the component versions of their respective applications, thereby achieving higher execution performance and optimizing transmission bandwidth overhead.
[0072] Example process
[0073] Figure 8 A flowchart of a method 800 for introducing a component to an application according to some implementations of this disclosure is shown. At block 810, an introduction operation is determined in the application definition, indicating the component to be introduced into the application; at block 820, an introduction mode for introducing the component to the application is obtained, including any one of the following: offline introduction mode and online introduction mode; at block 830, the component resource corresponding to the component is located in the component resource library associated with the application according to the introduction mode; and at block 840, the introduction operation in the definition is updated using the address of the component resource in the component resource library to introduce the component resource corresponding to the component to the application.
[0074] According to an exemplary implementation of this disclosure, the method 800 further includes: determining the application and the introduction mode based on an introduction configuration describing the introduction of components to the application.
[0075] According to an exemplary implementation of this disclosure, the update import operation includes at least one of the following: in response to determining that the component resource library includes component resources corresponding to the component, replacing the component identifier corresponding to the component in the import operation with the address of the component resource in the component resource library; in response to determining that the component resource library does not include component resources corresponding to the component, providing an alert message.
[0076] According to an exemplary implementation of this disclosure, the component resource library includes a set of component paths corresponding to a set of components to be introduced into the application, and the component path corresponding to a component in the set of component paths further includes a type path corresponding to the application type of the application, the type path pointing to the component resource.
[0077] According to an exemplary implementation of this disclosure, finding component resources includes: in response to determining that the import mode is online import mode, determining the application type of the application at runtime; and finding the component resource at the type path corresponding to the application type in the component resource library.
[0078] According to an exemplary implementation of this disclosure, finding component resources includes: in response to determining that the import mode is offline import mode, determining the application type of the application at the time of application compilation; and finding the component resource at the type path corresponding to the application type in the component resource library.
[0079] According to one exemplary implementation of this disclosure, the method further includes: performing an updated import operation to import component resources into the application.
[0080] According to an exemplary implementation of this disclosure, the component path further includes: another type path corresponding to another application type of another application, the other type path pointing to another component resource that will be introduced into another application.
[0081] According to an exemplary implementation of this disclosure, the application and the other application satisfy at least one of the following: the application and the other application are software applications for implementing different functions; the application and the other application are software applications developed on different operating systems for implementing the same functions.
[0082] According to an exemplary implementation of this disclosure, the method 800 further includes: in response to determining another application based on the import configuration, updating the import operation in the definition of the other application using the address of the other component resource in the component resource library, for importing the other component resource into the other application.
[0083] According to one exemplary implementation of this disclosure, component resources include at least one of the following: framework resources, style resources, interaction resources, and third-party components for implementing the component.
[0084] Example devices and equipment
[0085] Figure 9 A block diagram of an apparatus 900 for introducing a component to an application according to some implementations of the present disclosure is shown. The apparatus 900 includes: a determining module 910 configured to determine an introduction operation in the application's definition, the introduction operation indicating a component to be introduced into the application; an obtaining module 920 configured to obtain an introduction mode for introducing the component to the application, the introduction mode including any one of: an offline introduction mode and an online introduction mode; a searching module 930 configured to search for a component resource corresponding to the component in a component resource library associated with the application, based on the introduction mode; and an updating module 940 configured to update the introduction operation in the definition using the address of the component resource in the component resource library, for introducing the component resource corresponding to the component to the application.
[0086] According to an exemplary implementation of this disclosure, the apparatus 900 further includes: determining the application and the introduction mode based on an introduction configuration describing the introduction of components to the application.
[0087] According to an exemplary implementation of this disclosure, the update module 940 includes at least one of the following: a replacement module, configured to replace the component identifier corresponding to the component in the import operation with the address of the component resource in the component resource library in response to determining that the component resource library includes the component resource corresponding to the component; and a providing module, configured to provide alarm information in response to determining that the component resource library does not include the component resource corresponding to the component.
[0088] According to an exemplary implementation of this disclosure, the component resource library includes a set of component paths corresponding to a set of components to be introduced into the application, and the component path corresponding to a component in the set of component paths further includes a type path corresponding to the application type of the application, the type path pointing to the component resource.
[0089] According to an exemplary implementation of this disclosure, the lookup module 930 includes: a type determination module configured to determine the application type of the application at runtime in response to determining that the import mode is an online import mode; and a component lookup module configured to look up component resources at the type path corresponding to the application type in the component resource library.
[0090] According to an exemplary implementation of this disclosure, the lookup module 930 includes: a type determination module configured to determine the application type of the application at compile time in response to determining that the import mode is an offline import mode; and a component lookup module configured to look up component resources at the type path corresponding to the application type in the component resource library.
[0091] According to an exemplary implementation of this disclosure, the apparatus 900 further includes: an execution module configured to perform an update import operation in order to import component resources into the application.
[0092] According to an exemplary implementation of this disclosure, the component path further includes: another type path corresponding to another application type of another application, the other type path pointing to another component resource that will be introduced into another application.
[0093] According to an exemplary implementation of this disclosure, the application and the other application satisfy at least one of the following: the application and the other application are software applications for implementing different functions; the application and the other application are software applications developed on different operating systems for implementing the same functions.
[0094] According to an exemplary implementation of this disclosure, the update module 940 is further configured to: in response to determining another application based on the import configuration, update the import operation in the definition of the other application using the address of the other component resource in the component resource library, so as to import the other component resource into the other application.
[0095] According to one exemplary implementation of this disclosure, component resources include at least one of the following: framework resources, style resources, interaction resources, and third-party components for implementing the component.
[0096] Figure 10 A block diagram of a device 1000 capable of implementing various implementations of the present disclosure is shown. It should be understood that... Figure 10 The computing device 1000 shown is merely exemplary and should not be construed as limiting the functionality and scope of the implementation described herein. Figure 10 The computing device 1000 shown can be used to implement the method described above.
[0097] like Figure 10As shown, computing device 1000 is in the form of a general-purpose computing device. Components of computing device 1000 may include, but are not limited to, one or more processors or processing units 1010, memory 1020, storage device 1030, one or more communication units 1040, one or more input devices 1050, and one or more output devices 1060. Processing unit 1010 may be a physical or virtual processor and is capable of performing various processes according to programs stored in memory 1020. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of computing device 1000.
[0098] Computing device 1000 typically includes multiple computer storage media. Such media can be any available media accessible to computing device 1000, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 1020 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage device 1030 can be removable or non-removable media and may include machine-readable media, such as flash drives, disks, or any other media capable of storing information and / or data (e.g., training data for training) and accessible within computing device 1000.
[0099] The computing device 1000 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not explicitly stated... Figure 10 As shown, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks can be provided. In these cases, each drive can be connected to a bus (not shown) via one or more data media interfaces. Memory 1020 may include computer program product 1025 having one or more program modules configured to perform various methods or actions of various implementations of this disclosure.
[0100] The communication unit 1040 enables communication with other computing devices via a communication medium. Additionally, the components of the computing device 1000 can function as a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, the computing device 1000 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.
[0101] Input device 1050 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 1060 can be one or more output devices, such as a monitor, speaker, printer, etc. Computing device 1000 can also communicate with one or more external devices (not shown) via communication unit 1040 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with computing device 1000, or with any device (e.g., network card, modem, etc.) that enables computing device 1000 to communicate with one or more other computing devices. Such communication can be performed via input / output (I / O) interface (not shown).
[0102] According to exemplary implementations of this disclosure, a computer-readable storage medium is provided that stores computer-executable instructions thereon, wherein the computer-executable instructions are executed by a processor to implement the methods described above. According to exemplary implementations of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the methods described above. According to exemplary implementations of this disclosure, a computer program product is provided that stores a computer program thereon, which, when executed by a processor, implements the methods described above.
[0103] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0104] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0105] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0106] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0107] Various implementations of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
1. A method for introducing a component to an application, comprising: determining an introduction operation in a definition of the application, the introduction operation indicating a component to be introduced to the application; obtaining an introduction mode for introducing the component to the application, the introduction mode comprising either of: an offline introduction mode, an online introduction mode; determining an application type of the application; looking up, in a component repository associated with the application, a component resource of the component corresponding to the application type according to the introduction mode, the component repository comprising a plurality of component resources corresponding to a plurality of application types of a plurality of applications respectively; and updating the introduction operation in the definition with an address of the component resource in the component repository for introducing the component resource corresponding to the component to the application.
2. The method of claim 1, further comprising: determining the application and the introduction mode based on an introduction configuration describing introducing a component to the application. 3.The method of claim 2, wherein updating the introduction operation comprises at least either of: replacing a component identifier corresponding to the component in the introduction operation with the address of the component resource in the component repository in response to determining that the component repository comprises the component resource corresponding to the component; providing alert information in response to determining that the component repository does not comprise the component resource corresponding to the component. 4.The method of claim 2, wherein the component repository comprises a set of component paths corresponding to a set of components to be introduced to the application respectively, and a component path corresponding to the component in the set of component paths further comprises a type path corresponding to an application type of the application, the type path pointing to the component resource.
5. The method of claim 4, wherein finding the component resource comprises: in response to determining that the introduction mode is the online introduction mode, determining the application type of the application at runtime of the application; and looking up the component resource at the type path corresponding to the application type in the component repository.
6. The method of claim 4, wherein finding the component resource comprises: in response to determining that the introduction mode is the offline introduction mode, determining the application type of the application at compile time of the application; and looking up the component resource at the type path corresponding to the application type in the component repository.
7. The method of claim 4, further comprising: executing the updated introduction operation to introduce the component resource to the application.
8. The method of claim 4, wherein the component path further comprises: a further type path corresponding to a further application type of a further application, the further type path pointing to a further component resource of a further component to be introduced to the further application, wherein the application and the further application satisfy at least either of: the application and the further application are software applications for implementing different functions; the application and the further application are software applications developed based on different operating systems for implementing the same function.
9. The method of claim 8, further comprising: updating, in response to determining the further application based on the introduction configuration, an introduction operation in a definition of the further application with an address of the further component resource in the component repository for introducing the further component resource to the further application.
10. The method of claim 1, wherein the component resource comprises at least one of the following: a framework resource, a style resource, an interaction resource, a third-party component, for implementing the component.
11. An apparatus for introducing a component to an application, comprising: a determining module configured to determine, in a definition of the application, an introduction operation, the introduction operation indicating a component to be introduced to the application; an obtaining module configured to obtain an introduction mode for introducing the component to the application, the introduction mode comprising at least one of the following: an offline introduction mode, an online introduction mode; a finding module configured to: determine an application type of the application; and find, in a component resource repository associated with the application, a component resource of the component corresponding to the application type according to the introduction mode, the component resource repository comprising a plurality of component resources corresponding to a plurality of application types of a plurality of applications respectively; and 12. The apparatus of claim 11, further comprising: an updating module configured to update the introduction operation in the definition with an address of the component resource in the component resource repository for introducing the component resource corresponding to the component to the application. determine the application and the introduction mode based on an introduction configuration describing introducing a component to the application.
13. The apparatus of claim 12, wherein the updating module comprises at least one of the following: a replacing module configured to replace, in response to determining that the component resource repository comprises the component resource corresponding to the component, a component identifier corresponding to the component in the introduction operation with the address of the component resource in the component resource repository; a providing module configured to provide, in response to determining that the component resource repository does not comprise the component resource corresponding to the component, an alert information.
14. The apparatus of claim 13, wherein the component resource repository comprises a set of component paths corresponding to a set of components to be introduced to the application respectively, and a component path corresponding to the component in the set of component paths further comprises a type path corresponding to an application type of the application, the type path pointing to the component resource.
15. The apparatus of claim 14, wherein the finding module comprises: a type determining module configured to determine, in response to determining that the introduction mode is the online introduction mode, the application type of the application at a runtime of the application; and a component finding module configured to find the component resource at the type path corresponding to the application type in the component resource repository.
16. The apparatus of claim 14, wherein the finding module comprises: a type determining module configured to determine, in response to determining that the introduction mode is the offline introduction mode, the application type of the application at a compile time of the application; and a component finding module configured to find the component resource at the type path corresponding to the application type in the component resource repository. an executing module configured to execute the updated introduction operation to introduce the component resource to the application.
17. The apparatus of claim 14, wherein the component resources include at least any of: framework resources, style resources, interaction resources, third party components, for implementing the component, and the apparatus further comprises: 18. The apparatus of claim 14, wherein the component path further comprises: another application type corresponding to another application, the another type path pointing to another component resource of another component to be introduced into the another application, wherein the application and the another application satisfy at least any one of the following: the application and the another application are software applications for implementing different functions; the application and the another application are software applications developed based on different operating systems for implementing the same function.
19. An electronic device, comprising: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions which, when executed by the at least one processing unit, cause the electronic device to perform the method according to any one of claims 1 to 10.
20. A computer readable storage medium having stored thereon a computer program which, when executed by a processor, causes the processor to implement the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Front end assembly method suitable for mobile phone
CN103955364A