Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to an application page processing method and apparatus and a storage medium.
An application is a code instruction sequence that may be executed by a terminal having an information processing capability such as a computer to obtain a result or a symbolized instruction sequence or symbolized sentence sequence that may be automatically converted into a code instruction sequence. Currently, a user may install various applications, such as a photography application, a social networking application, or an email application, on a terminal, so as to implement various functions, such as a photography function, a social function, or an email management function, by using these applications installed on the terminal. An application page is generated after an application starts. After an instruction of switching an application page from a user is received, a new application page is loaded.
Based on the above, embodiments of this application provide an application page processing method and apparatus and a storage medium.
A first aspect of this application provides an application page processing method performed at a terminal having one or more processors and memory storing programs to be executed by the one or more processors, the method comprising:
running a parent application on an operating system of the terminal;
generating, by the parent application, a common page container by using a common resource of a plurality of sub-application pages, the common resource comprising page data that the plurality of sub-application pages commonly have;
in response to an event of launching a first sub-application page, loading an independent resource of the first sub-application page in the common page container, the independent resource comprising page data in the first sub-application page other than the common resource; and generating and displaying the first sub-application page according to the common page container.
A second aspect of this application further provides a terminal, comprising one or more processors; memory coupled to the one or more processors; and a plurality of computer programs stored in the memory that, when executed by the one or more processors, cause the terminal to perform the aforementioned application page processing method.
A third aspect of this application further provides a non-transitory computer readable storage medium storing a plurality of instructions in connection with a terminal having one or more processors, wherein the plurality of instructions, when executed by the one or more processors, cause the terminal to perform the aforementioned application page processing method.
To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer and more comprehensible, the following further describes the embodiments of the present disclosure in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely used for explaining the embodiments of the present disclosure but are not intended to limit the embodiments of the present disclosure.
The terminal 110 may communicate with the server by using the network 104 to obtain a service provided by the server. The terminal 110 may be a terminal device such as a smartphone, a tablet computer, a laptop computer, and a PC.
The terminal 110 may be connected to the network 104 by using the network interface 109 and communicate with other devices in the network 104.
The processor 105 may include one or more processors. Each processor may be a single-core processor or a multi-core processor. The processor 105 may implement various functions by executing a computer readable instruction stored in the memory 106.
The memory 106 may include one or more storage devices. The memory 106 may include an operating system 160, a network communications module 161, a parent application 162, and a data 107. The parent application 162 may be an application run on the operating system 160. The parent application 162 may communicate with the server by using the network 104 and obtain data from the server, to provide a service to a user of the terminal 110.
In some embodiments, the parent application 162 may provide an entrance to an application (referred to as a sub-application hereinafter) outside the parent application 162 and run a sub-application in the parent application 162. In some examples, the parent application is provided by the server 120, and the sub-applications may be respectively provided by a plurality of third-party devices 130. In this way, the parent application 162 and the sub-applications may be mutually independently developed, and the sub-applications may be spread in a platform provided by the parent application 162. For example, the parent application 162 may be an instant messaging application, a social networking application, or the like; the sub-applications may be various applications that provide various services to working, living, and entertainment of a user and may provide various services such as exchange rate query, dictionaries, notebooks, agenda reminding, and takeaway ordering.
In some embodiments, the sub-application may provide a service to the user in a form of a web page (such as an HTML5 page, H5 for short, page). In this case, the parent application 162 may open a page corresponding to the sub-application by using embedded browser code and execute processing logic in page data, to provide a function of the sub-application to the user. One sub-application may correspond to one or more pages, and these pages are collectively referred to as sub-application pages.
In the embodiments, the parent application 162 may include a common page container generation module 163, an independent resource loading module 164, and a page generation module 165.
The common page container generation module 163 may generate a common page container. For example, the data 107 stored in the memory 106 may include common resource data 171. The common page container generation module 163 may obtain a common resource from the common resource data 171 and generate the common page container by using the common resource.
The independent resource loading module 164 may load an independent resource of a sub-application page in the common page container. For example, in response to an event of launching a first sub-application page, an independent resource of the sub-application page is loaded in the common page container.
The page generation module 165 may generate and display the sub-application page by using the common page container in which the independent resource is loaded.
The common resource refers to page data that a plurality of sub-application pages commonly have. The common resource may be data that is preset in the parent application and that is used for providing basic functions of the sub-application page. For example, the common resource may include a rendering engine, a common code library, a software development kit (SDK), or the like. Code in the common code library may include script code, native language code, markup language code, and the like. The markup language code may include HyperText Markup Language (HTML) code, Cascading Style Sheets (CSS) code, and the like. The script code may include JavaScript code and the like.
The common page container is data of a page. The common page container generated by using the common resource corresponds to a blank page. The blank page may have basic page functions, and these basic page functions are provided by the common resource. The common page container may further include a code instruction, such as instruction code of the rendering engine, for generating the sub-application.
The independent resource of the sub-application page is page data in the sub-application page other than the common resource. In some examples, the independent resource may be page data provided by a developer of the sub-application. The developer of the sub-application may be a third-party service provider different from a developer of the parent application. The independent resource may include page layout data, page component data, processing logic code, and the like. After the independent resource of the sub-application page is loaded in the common page container, data corresponding to the common page container is data of the sub-application page. The common page container in which the independent resource is loaded is used for page rendering, so that rendering data of the sub-application page is generated, and the sub-application page is displayed on a display device. The independent resource loading module 164 may obtain the independent resource from the server 120 or third-party device 130. For example, the third-party device 130 may provide the independent resource of the sub-application page to the server 120, and the server 120 stores the independent resources of the sub-application pages, and when receiving an obtaining request from the terminal 110, provides a requested independent resource to the terminal 110. For another example, the terminal 110 may obtain information about the third-party device corresponding to the sub-application from the server and obtain the independent resource of the sub-application page from the third-party device according to the information. Examples are provided herein. Different manners of obtaining the independent resource may be used in other embodiments.
S11: Run a parent application on an operating system of the terminal.
S12: The parent application generates a common page container by using a common resource of a plurality of sub-application pages, the common resource including page data that the plurality of sub-application pages commonly have.
S13: In response to an event of launching a first sub-application page, load an independent resource of the sub-application page in the common page container, the independent resource including page data in the sub-application page other than the common resource.
Pages of sub-applications are collectively referred to as a sub-application page.
In the embodiments, the event of launching a first sub-application page may refer to receiving an instruction of running the first sub-application that is sent by the user in an interface of the parent application, or receiving an instruction of switching to a page of the first sub-application that is sent by the user in another page of the first sub-application, or receiving an instruction of switching to the first sub-application that is sent by the user in a page of another sub-application.
In the embodiments, when the event is an event of launching the first sub-application that is not currently run, an independent resource of a default page (such as a home page and a welcome page) of the first sub-application may be loaded in the common page container.
S14: Generate and display the first sub-application page according to the common page container.
A terminal device generates page rendering data according to the common page container in which the independent resource of the sub-application page is loaded, to render the corresponding sub-application page by using the page rendering data.
For example, a parent application may be run in the terminal 110, and the parent application is presented as a first user interface of the parent application shown in
In response to a click event of an interface component 302 in the first user interface, the terminal 110 is presented as a second user interface of a parent application shown in
In response to a click event of the entrance 303 of the first sub-application in the second user interface (that is, an event of switching to a page of the first sub-application), the parent application may load an independent resource of a first sub-application page in the common page container and generate rendering data by using the common page container in which the independent resource is loaded, so that the terminal 110 presents the first sub-application page shown in
In this embodiment of this application, the parent application generates the common page container by using the common resource of the plurality of sub-application pages in advance, and when detecting an event of launching a first sub-application page, then loads an independent resource of the sub-application page in the common page container, thereby improving running efficiency of a sub-application.
In some examples, when the first sub-application page is generated, the parent application may be prepared for subsequent possible page switching.
S21: Generate a second common page container when generating a first sub-application page.
S22: In response to an event of switching to a second sub-application page, load an independent resource of the second sub-application page in the second common page container.
S23: Generate and display the second sub-application page according to the second common page container.
In some examples, when the second common page container is generated, the second common page container may be created by using the common resource. That is, a new common page container is created as the second common page container.
In some examples, when the second common page container is generated, a second independent resource may be removed from a third common page container in which the second independent resource is loaded, to obtain the second common page container. That is, an existing common page container is reused.
For example, the parent application creates two common page containers, for example, a first common page container and the third common page container.
In response to an event of switching to a first sub-application page, a first independent resource of the first sub-application page is loaded in the first common page container.
In response to an event of switching to a second sub-application page, a second independent resource of the second sub-application page is loaded in the third common page container.
In response to an event of switching to a third sub-application, a first independent resource is removed from the first common page container (a second common page container is used herein to indicate the first common page container from which the first independent resource is removed), and a third independent resource of a third sub-application page is loaded in the second common page container.
In some examples, when an event of launching a first sub-application page is an event of launching a first sub-application page of a sub-application that is not currently run, an independent resource of a default sub-application page of the sub-application may be obtained, and the default sub-application page is generated and displayed.
The default sub-application page is a sub-application page that is entered by default when the first sub-application is started, may be a sub-application page designated by a third party when the first sub-application is developed, or may be a sub-application page when the first sub-application is exited after use last time. When an event of launching the first sub-application is detected, an identifier of the first sub-application is obtained, a page identifier of a default sub-application page of the first sub-application is obtained according to the identifier of the first sub-application, and an independent resource of the default sub-application page is found according to the page identifier of the default sub-application page.
The independent resource of the default sub-application page may be obtained from the server 120 or the third-party device 130 corresponding to the sub-application or may be obtained from the terminal 110. The independent resource of the default sub-application page may be downloaded to the terminal 110 and be saved in the terminal 110 when the sub-application is run for the first time. The saved independent resource may be updated after an update notification of the server or third-party device is received or may be updated by the parent application through query from the server or third-party device at a preset time interval.
In some examples, when obtaining the independent resource of the sub-application page, the parent application may obtain a configuration file of a sub-application page provided by the third-party device from the server and obtain page component information of the sub-application page from the configuration file. Data of page components is obtained according to the page component information, and the data of the page components is loaded in the common page container.
The configuration file of the sub-application page is a file for describing the sub-application page. The configuration file of the sub-application page may be source code or a file obtained after source code is complied. The configuration file may include information about components included in the sub-application page, and components in the sub-application page may be determined according to the configuration file of the sub-application page. The parent application may obtain the configuration file of the sub-application page from the terminal 110, the server 120, or the third-party device 130.
In some examples, when obtaining the data of the page components according to the page component information, the parent application may obtain a common component identifier in the sub-application page from the configuration file and load data of a common component corresponding to the common component identifier in the parent application in the common page container.
The common component is a page component that is provided by the parent application and that may be commonly used by different sub-applications. The page component may include a display component and/or processing logic. The parent application may obtain the common component data 172 from data stored in the memory 106 of the terminal 110. The sub-application may use, by including information about the common component in the configuration file, the common component provided by the parent application.
In some examples, in response to an operation on the common component in the sub-application page, the parent application may execute processing logic corresponding to the common component. For example, logic code for processing an event triggered by the common component is encapsulated in some common components. When the common component is a control, when the control is clicked, the parent application may execute the logic code encapsulated in the control, to perform corresponding operations.
In some examples, when obtaining the independent resource of the sub-application page, the parent application may obtain from the server business logic code of the sub-application page provided by the third-party device, obtain business data by running the business logic code, and load the business data in the common page container. The business logic code is code of processing logic included in the sub-application page. The business logic code may be native language code or script code. The script code is, for example, JavaScript code. The business logic code may be obtained locally or from the server. The business logic code is provided by the third-party device that develops the sub-application, and the third-party device uploads the business logic code of the sub-application page to the server.
A file that is needed to generate a sub-application page is stored on the server 120, and the file is, for example, a sub-application global logic file corresponding to a sub-application identifier, a sub-application global configuration file, a sub-application page configuration file, and a page pattern file. Page preloading configuration information is also stored on the server 120. The page preloading configuration information records a preloading relationship between the sub-application pages. For example, the preloading relationship may include preloading a sub-application page 2 when a sub-application page 1 is presented, preloading a sub-application page 3 when the sub-application page 2 is presented, and the like.
An operating system is run on the terminal 110, and a parent application is run on the operating system. The terminal 110 performs the application page processing method by using the parent application, to implement the sub-application page by using the parent application. The terminal 110 may specifically create a sub-application logic layer processing unit and a corresponding sub-application view layer processing unit by using the parent application. The sub-application view layer processing unit may be configured to generate a sub-application page.
In an embodiment, the terminal 110 may preload a common resource of different sub-application pages as a common page container by using the sub-application logic layer processing unit, determine a page identifier having a preloading relationship with a sub-application page identifier (referred to as a page identifier hereinafter) of the generated sub-application page, and load an independent resource of a sub-application page corresponding to the determined page identifier in the common page container. The terminal 110 may obtain an event of launching a first sub-application page corresponding to the determined page identifier by using the sub-application view layer processing unit and transfer the event to the sub-application logic layer processing unit. The sub-application logic layer processing unit makes a response to the event, and transfers page rendering data that is generated according to the common page container in which the independent resource of the sub-application page is loaded to the sub-application view layer processing unit. The terminal 110 may generate the sub-application page by using the sub-application view layer processing unit and according to the page rendering data.
S32: Preload a common resource of different sub-application pages as a common page container in an environment provided by a parent application, the parent application being run on an operating system.
In the embodiments, “preloading a common resource as a common page container in an environment provided by a parent application” means that the parent application generates the common page container by using the common resource of the sub-application page before obtaining an event for launching a first sub-application page.
Referring to
The parent application is an application carrying the sub-application and provides an environment to implementation of the sub-application. The parent application is a native application. The native application is an application that may be directly run on the operating system. The sub-application is an application that may be implemented in the environment provided by the parent application. The parent application and the sub-application may be mutually independently developed.
The parent application may be a social networking application, a dedicated application that is dedicatedly used for supporting a sub-application, a file management application, an email application, a game application, or the like. The social networking application includes an instant messaging application, a social network service (SNS) application, a live broadcast application, or the like. The sub-application may be specifically a social networking application program, a file management application, an email application, a game application, or the like.
The common resource, such as a rendering engine, a common code library, or a software development kit (SDK), is a resource that is commonly used by generation of different sub-application pages. Code in the common code library is, for example, script code, native language code, or markup language code. The markup language code is, for example, HyperText Markup Language (HTML) code or cascading style sheets (CSS) code. The script code is, for example, JavaScript code.
The common page container can be used for generating a blank sub-application page. After content in the sub-application page is loaded in the common page container, the common page container may be used for generating the corresponding sub-application page. The common resource is preloaded as the common page container, and a developer of the sub-application does not need to pay attention to a dependency relationship between the common resources and may directly use content provided by the common page container.
S34: Determine a sub-application page identifier that has a preloading relationship with a sub-application page identifier of a generated sub-application page.
That the determined sub-application page identifier of a sub-application page has a preloading relationship with the sub-application page identifier of the generated sub-application page means that a sub-application page represented by the determined sub-application page identifier on the premise of the generated sub-application page is preloaded. The generated sub-application page may be a sub-application page that is being presented. The sub-application page mentioned in this embodiment of the present disclosure corresponds to the same sub-application identifier if not especially described. In an embodiment, the generated sub-application page may be generated before step S32.
In an embodiment, the preloading relationship between the sub-application page identifiers may be configured by an account having configuration permission, and the account having configuration permission is, for example, an account of a developer of the parent application or an account of a developer of the sub-application.
In an embodiment, the preloading relationship between the sub-application page identifiers may be determined according to content correlation between the corresponding sub-application pages, and the content correlation may be obtained by calculating page similarity between the corresponding sub-application pages.
S36: Load an independent resource of a sub-application page corresponding to the determined sub-application page identifier in the common page container.
The independent resource of the sub-application page is different from the common resource between the different sub-application pages and is a difference between the different sub-application pages. The independent resource of the sub-application page corresponding to the determined page identifier is a difference between the sub-application page represented by the determined page identifier and other sub-application pages. The difference is not limited to difference between presented content and may further include a logic difference and a page structure difference.
The independent resource of the sub-application page cooperates with the common resource, to together generate the sub-application page. The independent resource of the sub-application page may include business logic code, a page element identifier, business data, or the like. The business logic code is logic code for implementing business of the sub-application, and the business data is data that is needed to implement business of the sub-application.
In an embodiment, the independent resource of the sub-application page corresponding to the page identifier may be immediately downloaded from the server or may be locally read, for example, be locally cached or be read from a local file. An independent resource of a local sub-application page may be downloaded to a local location from the server in advance.
S38: When an event for switching to the sub-application page corresponding to the determined page identifier is obtained, generate the sub-application page corresponding to the determined page identifier according to the common page container in which the independent resource of the sub-application page is currently loaded.
Specifically, the terminal may detect or monitor, by using the parent application, an event triggered in the generated sub-application page. The event for switching to the sub-application page corresponding to the determined page identifier may be specifically an event of clicking a link, an event of entering a next page, or the like.
When the event for switching to the sub-application page corresponding to the determined page identifier is detected, the terminal may generate the sub-application page by using the parent application and according to the common page container in which the independent resource of the sub-application page is loaded. The terminal may specifically generate page rendering data by using the parent application and according to the common page container in which the independent resource of the sub-application page is loaded, to render the corresponding sub-application page by using the page rendering data. The generated sub-application page becomes an already generated sub-application page.
In an embodiment, the terminal may preload a new common page container by using the parent application when or after step S38 is performed. The terminal may also cache the generated sub-application page by using the parent application.
In the foregoing application page processing method, the parent application is run on the operating system, the parent application generates the sub-application page, and the sub-application is run in a form of the sub-application page, so that the sub-application does not need to be installed, thereby reducing time consumed by installation of the sub-application and improving running efficiency of the sub-application. In addition, the common resource between different sub-application pages is preloaded as the common page container, and after a sub-application page that needs to be preloaded is determined, the independent resource of the sub-application page is further loaded, so that not all resources of the sub-application page need to be loaded every time, thereby further improving running efficiency of the sub-application through preloading.
In an embodiment, after step S32 and before step S34, the application page processing method further includes steps of generating a default sub-application page according to the preloaded common page container and preloading a new common page container. Referring to
S502: Obtain a page identifier of a default sub-application page.
The default sub-application page is a sub-application page that is entered by default when the sub-application is started, may be a sub-application page designated when the sub-application is developed, or may be a sub-application page when the sub-application is exited after use last time. The page identifier is used for uniquely identifying a corresponding sub-application page. The terminal may obtain a sub-application start instruction by using the parent application, to obtain a sub-application identifier designated by the sub-application start instruction, to obtain the page identifier of the default sub-application page corresponding to the sub-application identifier.
S504: Preload an independent resource of a sub-application page corresponding to the page identifier of the default sub-application page in a common page container.
The loaded independent resource of the sub-application page corresponding to the page identifier of the default sub-application page may be immediately downloaded from the server or may be locally read, for example, be locally cached or be read from a local file. An independent resource of a local sub-application page may be downloaded to a local location from the server in advance.
S506: Generate the default sub-application page according to the common page container in which the independent resource of the sub-application page corresponding to the page identifier of the default sub-application page is loaded.
Specifically, the terminal may specifically generate page rendering data according to the common page container in which the independent resource of the sub-application page corresponding to the page identifier of the default sub-application page is loaded, to render the corresponding sub-application page by using the page rendering data.
S508: Re-preload a common resource as a new common page container.
Specifically, the terminal may preload the common resource between different sub-application pages as the new common page container when the independent resource of the sub-application page is loaded in the common page container by using the parent application or when the sub-application page is generated.
In this embodiment, the common page container is preloaded, the default sub-application page is rapidly generated by using the preloaded common page container, the common resource between different sub-application pages is preloaded as the new common page container, and switching is rapidly performed between different sub-application pages by using the new common page container, thereby further improving use efficiency of the sub-application.
In an embodiment, step S34 specifically includes: obtaining page preloading configuration information configured by an account having configuration permission on the server, and searching the preloading configuration information for the page identifier that has the preloading relationship with the page identifier of the generated sub-application page.
The page preloading configuration information is configuration information of the preloading relationship between the sub-application pages, and the page preloading configuration information may record a preloading relationship between pages. The account having configuration permission is an account having permission of configuring the page preloading configuration information, such as an account of a sub-application developer.
Specifically, the server may provide a sub-application configuration page corresponding to the sub-application identifier, obtain the preloading relationship between the pages that is recorded by the sub-application configuration page, and record the obtained preloading relationship in the page preloading configuration information corresponding to the sub-application identifier on the server.
Further, the terminal may obtain the page preloading configuration information corresponding to the sub-application identifier by using the parent application form the server or locally, to search the obtained preloading configuration information for the page identifier, and the found page identifier has the preloading relationship with the page identifier of the generated sub-application page in the preloading configuration information. The local page preloading configuration information may be downloaded from the server in advance and be locally stored.
In this embodiment, the preloading relationship between the pages may be configured on the server by using the account having configuration permission, and preloading relationships between sub-application pages that are implemented on terminals by using the parent application may be conveniently and uniformly managed by using the account.
In an embodiment, step S34 specifically includes: obtaining page preloading configuration information that is configured by an account having configuration permission and that corresponds to the sub-application identifier on the server, and searching the preloading configuration information for the page identifier that has the preloading relationship with the page identifier of the generated sub-application page. The page identifier of the generated sub-application page and the found page identifier of the sub-application page both correspond to the same sub-application identifier.
In an embodiment, step S34 specifically includes: sending a query request carrying the page identifier of the generated sub-application page to the server and receiving the page identifier of the sub-application page that is found in the page preloading configuration information according to the page identifier of the generated sub-application page and that is sent by the server, where the found page identifier of the sub-application page has a preloading relationship with the page identifier of the generated sub-application page in the page preloading configuration information, and the page preloading configuration information is configured by the account having configuration permission.
In this embodiment, query from the server may be conducted according to needs to determine a sub-application page that needs to be preloaded; when the preloading relationship configured on the server changes, change of the preloading relationship can be embodied in time, thereby further improving use efficiency of the sub-application.
In an embodiment, step S34 includes: sending a query request carrying the sub-application identifier and the page identifier of the generated sub-application page to the server and receiving the page identifier of the sub-application page that is found by the server from the page preloading configuration information corresponding to the sub-application identifier, where the found page identifier of the sub-application page has a preloading relationship with the page identifier of the generated sub-application page in the page preloading configuration information, and the page preloading configuration information is configured by the account having configuration permission.
In this embodiment, the preloading relationship between the sub-application pages may be configured for different sub-applications, so that query from the server is conducted according to needs, to determine a sub-application page that needs to be currently preloaded by a current sub-application, thereby supporting preloading of a plurality of sub-applications and further improving use efficiency of the sub-applications.
As shown in
S602: Obtain a configuration file of a sub-application page corresponding to a determined sub-application page identifier.
The configuration file of the sub-application page is a file for configuring a presented page. The configuration file of the sub-application page may be source code or a file obtained after source code is complied. The page presented by the sub-application is referred to as a sub-application page, and one sub-application may include one or more sub-application pages.
Specifically, the terminal may obtain the configuration file of the sub-application page corresponding to the determined sub-application page identifier by using the parent application locally or from the server. The terminal may also obtain the sub-application identifier, to obtain the configuration file of the sub-application page corresponding to the sub-application identifier and the determined sub-application page identifier.
In an embodiment, the terminal may present a sub-application list by using the parent application, receive a selection instruction for options in the sub-application list, and determine an option selected in the sub-application list according to the selection instruction, to obtain a sub-application identifier corresponding to the selected option.
S604: Obtain a common component identifier from the configuration file of the sub-application page.
Specifically, the terminal may parse the configuration file of the sub-application page, to obtain the common component identifier from the configuration file of the sub-application page. The common component identifier is used for uniquely identifying a corresponding common component. The common component is a component that is provided by the parent application and that may be commonly used by different sub-applications, has a visual form, and is a component unit of the sub-application page. Logic code for processing an event triggered by the common component may also be encapsulated in the common component. That different sub-applications commonly use the common component may be specifically that the same common component is called at the same time or at different moments. In an embodiment, the common component may be commonly used by the parent application and the sub-applications.
S606: Load a local common component corresponding to the common component identifier in a common page container.
Specifically, the terminal may load the common component that corresponds to the common component identifier and that is provided by the common page container in the common page container by using the parent application. The loaded common component may be a common component that corresponds to the common component identifier and that is selected from a common component library provided by the common page container.
The common component library is a set composed of common components provided by the parent application. Each common component in the common component library has a unique common component identifier. The common component library may be downloaded by the parent application from the server to a local location during running or may be obtained through de-compression by the parent application from a corresponding application installation package when the parent application is installed.
In an embodiment, the terminal may load component pattern data corresponding to the common component identifier in the common page container. The component pattern data is data for describing a presentation form of a corresponding common component. The component pattern data may include attributes, such as a location, a size, a color, a font, and a font size, of the corresponding common component in the sub-application page.
In this embodiment, use efficiency of the sub-application may be further improved by combining the locally provided common component with a preloading manner.
As shown in
S702: Obtain business logic code corresponding to a determined page identifier.
The business logic code is code of processing logic of the sub-application page and may be a native language code or script code. The script code is, for example, JavaScript code. The business logic code may be obtained locally or from the server.
S704: Run the business logic code to obtain business data.
Specifically, the terminal may run the business logic code, and business data is obtained when the business logic code is run. Specifically, the business data may be directly obtained locally or from the server according to business logic in the business logic code or may be obtained through calculation according to business logic in the business logic code. The business data is different because the sub-application is different and may be social relationship data, social communication data, email data, game data, or the like.
S706: Load the business data to a common page container.
Specifically, the business data may be bound with a page element identifier in the corresponding sub-application page; when generating the sub-application page, the terminal renders the business data to a page element corresponding to the page element identifier bound by the business data. The page element is, for example, the common component or a self-defined picture.
In this embodiment, the business logic code may be run after the common page container is preloaded, to obtain the business data, to preload the business data in the common page container, thereby further improving use efficiency of the sub-application.
In an embodiment, the sub-application page is generated by a sub-application view layer processing unit that is in a one-to-one correspondence with the sub-application page; the common page container is preloaded by a sub-application logic layer processing unit; the independent resource of the sub-application page is loaded by the sub-application logic layer processing unit; the sub-application view layer processing unit and the sub-application logic layer processing unit are created by the parent application.
Specifically, referring to
As shown in
S902: Preload a common resource of different sub-application pages by using a sub-application logic layer processing unit as a common page container; a parent application is run on an operating system; the sub-application logic layer processing unit is created by the parent application.
S904: Determine a page identifier that has a preloading relationship with a page identifier of a generated sub-application page by using the sub-application logic layer processing unit; load an independent resource of a sub-application page corresponding to the determined page identifier in the common page container.
S906: Obtain an event for switching from the generated sub-application page to the sub-application page corresponding to the determined page identifier by using a sub-application view layer processing unit and transfer the event to the sub-application logic layer processing unit, the sub-application view layer processing unit and the sub-application logic layer processing unit being created by the parent application.
S908: Make a response to the event by using the sub-application logic layer processing unit, generate page rendering data according to the common page container in which the independent resource of the sub-application page is loaded, and transfer the page rendering data to the sub-application view layer processing unit.
S910: Generate the sub-application page by using the sub-application view layer processing unit and according to the page rendering data.
In this embodiment, the sub-application page is in a one-to-one correspondence with the sub-application view layer processing unit, so that each sub-application page is independent of each other. The sub-application view layer processing unit performs view presentation on the common page container and the independent resource of the sub-application page after the common page container and the independent resource of the sub-application page are both preloaded by using the sub-application logic layer processing unit, to facilitate efficient management of the sub-application page, thereby further improving use efficiency of the sub-application. In addition, the sub-application logic layer processing unit and the corresponding sub-application view layer processing unit separates a view layer and a logic layer of the application, and the configuration file of the sub-application page and logic code of the sub-application page may be respectively updated and used, thereby better facilitating implementation and maintenance of the sub-application.
In an embodiment, the configuration file of the sub-application page is compiled in a markup language. The logic code of the sub-application page is compiled in a script language. The sub-application logic layer processing unit and the sub-application view layer processing unit transit and communicate by using a native interface provided by the parent application.
The markup language is computer text coding that presents a document structure and data processing details by combining texts and other information related to the texts. The configuration file of the sub-application page may use an HTML, an XML, or an XML-extension-based self-defined markup language. The script language is, for example, JavaScript or VBScript. The native interface is an interface locally supported by the operating system, and may be, for example, Javascript Bridge. In an Android operating system, the native interface is a local frame and is compiled in a C language and/or a C++ language.
In this embodiment, the configuration file of the sub-application page is compiled in a markup language, so that edition of the configuration file of the sub-application page is intuitive and convenient. The logic code of the sub-application page is compiled in a script language, to implement logic of the sub-application. In addition, the sub-application logic layer processing unit and the sub-application view layer processing unit that use different computer languages may normally communicate by using the native interface provided by the parent application.
In an embodiment, the application page processing method further includes: calling, by using the sub-application logic layer processing unit and according to business logic code, an application programming interface response event provided by the parent application. In this embodiment, the event triggered in the sub-application page is processed by using the application programming interface provided by the parent application; the business logic code is used for configuring calling of the application programming interface provided by the parent application, so that the sub-application is implemented in a more lightweight manner.
In an embodiment, the application page processing method further includes: calling, by using the sub-application logic layer processing unit and according to business logic code, an application programming interface response event provided by the operating system. In this embodiment, the application programming interface processing event provided by the operating system is directly called by using the parent application, so that the sub-application is implemented in a more lightweight manner.
In an embodiment, the application page processing method further includes: calling, by using the sub-application logic layer processing unit and according to business logic code, an application programming interface provided by the parent application and calling, by using the application programming interface provided by the parent application, an application programming interface response event provided by the operating system. In this embodiment, the parent application processes, by using the application programming interface provided by the operating system, the event triggered in the sub-application page. This can alleviate burden on the parent application compared to that the event is completely processed by the parent application.
As shown in
The common page container preloading module 1001 is configured to preload a common resource of different sub-application pages as a common page container in an environment provided by a parent application, the parent application being run on an operating system.
The sub-application page independent resource preloading module 1002 is configured to: determine a page identifier that has a preloading relationship with a page identifier of a generated sub-application page; and load an independent resource of a sub-application page corresponding to the determined page identifier in the common page container.
The sub-application page generation module 1003 is configured to, when an event for switching to the sub-application page corresponding to the determined page identifier is obtained, generate the sub-application page corresponding to the determined page identifier according to the common page container in which the independent resource of the sub-application page is currently loaded.
In the foregoing application page processing apparatus 1000, the parent application is run on the operating system, and the parent application generates the sub-application page, thereby reducing time consumed by installation of the application and improving use efficiency of the sub-application. In addition, the common resource between different sub-application pages is preloaded as the common page container, and after a sub-application page that needs to be preloaded is determined, the independent resource of the sub-application page is further loaded, so that not all resources of the sub-application page need to be loaded every time, thereby further improving use efficiency of the sub-application through preloading.
In an embodiment, the sub-application page independent resource preloading module 1002 is further configured to: obtain a page identifier of a default sub-application page; and preload an independent resource of a sub-application page corresponding to the page identifier of the default sub-application page in a common page container.
The sub-application page generation module 1003 is further configured to generate the default sub-application page according to the common page container in which the independent resource of the sub-application page corresponding to the page identifier of the default sub-application page is loaded.
The common page container preloading module 1001 is further configured to re-preload a common resource as a new common page container.
In this embodiment, the common page container is preloaded, the default sub-application page is rapidly generated by using the common page container, and after the new common page container is generated, and switching is rapidly performed between different sub-application pages by using the common page container, thereby further improving use efficiency of the sub-application.
In an embodiment, the sub-application page independent resource preloading module 1002 is further configured to obtain page preloading configuration information on the server and search the preloading configuration information for a page identifier that has a preloading relationship with a page identifier of a generated sub-application page, the page preloading configuration information being configured by an account having configuration permission.
In this embodiment, the preloading relationship between the pages may be configured on the server by using the account having configuration permission, and preloading relationships between sub-application pages that are implemented on terminals by using the parent application may be conveniently and uniformly managed by using the account.
In an embodiment, the sub-application page independent resource preloading module 1002 is further configured to: send a query request carrying the page identifier of the generated sub-application page to the server and receive the page identifier of the sub-application page that is found in the page preloading configuration information according to the page identifier of the generated sub-application page and that is sent by the server, where the found page identifier of the sub-application page has a preloading relationship with the page identifier of the generated sub-application page in the page preloading configuration information, and the page preloading configuration information is configured by the account having configuration permission.
In this embodiment, query from the server may be conducted according to needs to determine a sub-application page that needs to be preloaded; when the preloading relationship configured on the server changes, change of the preloading relationship can be embodied in time, thereby further improving use efficiency of the sub-application.
In an embodiment, the sub-application page independent resource preloading module 1002 is further configured to: obtain a configuration file of a sub-application page corresponding to the determined page identifier; obtain a common component identifier from the configuration file of the sub-application page; and load a local common component corresponding to the common component identifier in a common page container.
In this embodiment, use efficiency of the sub-application may be further improved by combining the locally provided common component with a preloading manner.
In this embodiment, the independent resource of the sub-application page includes business logic code; the sub-application page independent resource preloading module 1002 is further configured to: obtain the business logic code corresponding to the determined page identifier; run the business logic code to obtain business data; and load the business data to the common page container.
In this embodiment, the business logic code may be run after the common page container is preloaded, to obtain the business data, to preload the business data in the common page container, thereby further improving use efficiency of the sub-application.
In an embodiment, the common page container preloading module 1001 is further configured to generate a corresponding sub-application page by using a sub-application view layer processing unit, the sub-application view layer processing unit being in a one-to-one correspondence with the corresponding sub-application page.
The sub-application page independent resource preloading module 1002 is further configured to preload the common page container and the independent resource of the sub-application page by using a sub-application logic layer processing unit.
The sub-application view layer processing unit and the sub-application logic layer processing unit are created by the parent application.
In this embodiment, the sub-application page is in a one-to-one correspondence with the sub-application view layer processing unit, so that each sub-application page is independent of each other. The sub-application view layer processing unit performs view presentation on the common page container and the independent resource of the sub-application page after the common page container and the independent resource of the sub-application page are both preloaded by using the sub-application logic layer processing unit, to facilitate efficient management of the sub-application page, thereby further improving use efficiency of the sub-application. In addition, the sub-application logic layer processing unit and the corresponding sub-application view layer processing unit separates a view layer and a logic layer of the application, and the configuration file of the sub-application page and logic code of the sub-application page may be respectively updated and used, thereby better facilitating implementation and maintenance of the sub-application.
A person of ordinary skill in the art may understand that all or some of the processes of the methods of the foregoing embodiments may be implemented by a computer program instructing relevant hardware. The program may be stored in a non-volatile computer readable storage medium. When the program is executed, the program may include the processes of the embodiments of the foregoing methods. The storage medium may be a magnetic disk, an optical disc, a read-only memory (ROM), or the like.
Technical features of the foregoing embodiments may be randomly combined. To make description concise, not all possible combinations of the technical features in the foregoing embodiments are described. However, as long as combinations of these technical features do not contradict each other, it should be considered that the combinations all fall within the scope recorded by this specification.
The above embodiments only express several implementations of the embodiments of the present disclosure, which are described specifically and in detail, but cannot be accordingly construed as a limitation to the patent scope of the present disclosure. It should be noted that a person of ordinary skill in the art may make various transformations and improvements without departing from the ideas of the embodiments of the present disclosure, which all fall within the protection scope of the embodiments of the present disclosure. Therefore, the protection scope of the patent of the embodiments of the present disclosure shall be subject to the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
201611062086.6 | Nov 2016 | CN | national |
This application is a continuation application of PCT/CN2017/112060, entitled “METHOD AND DEVICE FOR PROCESSING APPLICATION PROGRAM PAGE, AND STORAGE MEDIUM” filed on Nov. 21, 2017, which claims priority to China Patent Application No. 201611062086.6, filed with the Chinese Patent Office on Nov. 25, 2016 and entitled “METHOD AND DEVICE FOR PROCESSING APPLICATION PROGRAM PAGE, AND STORAGE MEDIUM”, both of which are incorporated herein by reference in their entirety.
Number | Name | Date | Kind |
---|---|---|---|
8082294 | Krahulec | Dec 2011 | B2 |
8868637 | Rosenstein | Oct 2014 | B2 |
9268547 | Manion | Feb 2016 | B2 |
20020038349 | Perla | Mar 2002 | A1 |
20050188329 | Cutler | Aug 2005 | A1 |
20060143622 | Prabandham | Jun 2006 | A1 |
20070143704 | Laird-McConnell | Jun 2007 | A1 |
20080071929 | Motte | Mar 2008 | A1 |
20080091761 | Tsao | Apr 2008 | A1 |
20080201118 | Luo | Aug 2008 | A1 |
20110055683 | Jiang | Mar 2011 | A1 |
20110138288 | Blum | Jun 2011 | A1 |
20110225243 | Almeida | Sep 2011 | A1 |
20130006724 | Simanek | Jan 2013 | A1 |
20130091513 | Underdal | Apr 2013 | A1 |
20130144948 | Carriero | Jun 2013 | A1 |
20140089947 | Han | Mar 2014 | A1 |
20140282240 | Flynn, III | Sep 2014 | A1 |
20140298249 | Lee | Oct 2014 | A1 |
20170102966 | Dallala | Apr 2017 | A1 |
20170279869 | Neagu | Sep 2017 | A1 |
Number | Date | Country |
---|---|---|
1722088 | Jan 2006 | CN |
102065133 | May 2011 | CN |
102193793 | Sep 2011 | CN |
103475744 | Dec 2013 | CN |
103530160 | Jan 2014 | CN |
103677804 | Mar 2014 | CN |
104731598 | Jun 2015 | CN |
105759962 | Jul 2016 | CN |
106502736 | Mar 2017 | CN |
Entry |
---|
Tencent Technology, Written Opinion, PCT/CN2017/112060, dated Feb. 22, 2018, 5 pgs. |
Tencent Technology, IPRP, PCT/CN2017/112060, May 28, 2019, 6 pgs. |
Tencent Technology, ISR, PCT/CN2017/112060, Feb. 22, 2018, 2 pgs. |
Number | Date | Country | |
---|---|---|---|
20190220304 A1 | Jul 2019 | US |
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2017/112060 | Nov 2017 | US |
Child | 16359795 | US |