Page data processing method, electronic equipment, storage medium and program product
By building a notification sending and receiving channel between cross-end pages and native pages, the problems of complexity and inefficiency of data interaction in the prior art are solved, and a simplified data interaction process and efficient data transmission are achieved.
Patent Information
- Application Number
- CN202411795008.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-18
AI Technical Summary
In the prior art, the data interaction method between cross-end pages and native pages is relatively complex, resulting in low data interaction efficiency.
By building a notification sending and receiving channel between the front desk page and the back desk page, obtain the sendable data published by the front desk page, and determine the target page in the back desk page with notifications subscribed to, generate notifications to be sent based on the sendable data, and finally send notifications to the target page through the notification sending channel.
It simplifies the data interaction process between cross-end pages and native pages, improves data interaction efficiency, and improves code maintainability and development efficiency.
Smart Images

Figure CN119645684A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of computers, and more particularly to a page data processing method, an electronic device, a readable storage medium, and a computer program product. Background Art
[0002] With the diversification of terminal platforms, the types of terminal platforms that application pages need to be compatible with are gradually increasing. Therefore, in order to reduce development costs, cross-platform technology can be used for page development.
[0003] When using the application page, communication between the cross-end page and the native page is required. The current data interaction method between the cross-end page and the native page is relatively complex and has low data interaction efficiency. Summary of the invention
[0004] The present disclosure provides a page data processing method, an electronic device, a readable storage medium, and a computer program product.
[0005] In a first aspect, the present disclosure proposes a page data processing method, including: constructing a notification sending and receiving channel between a foreground page and a background page, the page types of the foreground page and the background page include cross-end pages and native pages, and at least one of the foreground page and the background page is the cross-end page; obtaining sendable data of the foreground page published by the foreground page, the sendable data being used for data interaction between different pages; determining a target page subscribed to a notification type corresponding to the sendable data in the background page subscribed to notifications; generating a to-be-sent notification of the foreground page based on the sendable data; and sending the to-be-sent notification to the target page through the notification sending and receiving channel.
[0006] According to some embodiments of the present disclosure, the cross-end page and the native page are both configured with corresponding page engines, the foreground page publishes the sendable data through the corresponding page engine, and the background page subscribes to notifications through the corresponding page engine.
[0007] According to some implementations of the present disclosure, the background page includes at least one cross-end page, and at least some of the cross-end pages in the background page correspond to one of the page engines respectively.
[0008] According to some embodiments of the present disclosure, the page engine of the cross-end page corresponds to a plug-in instance generated based on a cross-platform framework, and the plug-in instance is used to perform at least the following steps: the step of determining, in the background page subscribed to notifications, a target page subscribed to a notification type corresponding to the sendable data; and the step of sending the notification to be sent to the target page through the notification sending and receiving channel.
[0009] According to some implementations of the present disclosure, the life cycle of the plug-in instance is greater than or equal to the life cycle of the cross-end page.
[0010] According to some embodiments of the present disclosure, before building a notification sending and receiving channel between a foreground page and a background page, the method also includes: in response to receiving a page opening indication, opening a new page, wherein the new page forms a foreground page when opened, and the new page does not belong to any type of the background pages; and if the new page is a cross-end page, adding the page engine of the new page to a plug-in management class, and providing the specified subscribed notification type of the new page to the page engine of the background page, wherein the page engine of the cross-end page has the ability to send and receive notifications with other pages through the method provided by the plug-in management class.
[0011] According to some embodiments of the present disclosure, the method further includes: in response to receiving a page destruction indication, removing the page engine of the page to be destroyed from the plug-in management class, and stopping the page to be destroyed from providing the specified subscribed notification type to the page engines of other pages.
[0012] According to some embodiments of the present disclosure, determining a target page subscribed to a notification type corresponding to the sendable data in the background page subscribed to notifications includes: traversing the page engine of the background page belonging to the cross-end page, and determining a target page subscribed to a notification type corresponding to the sendable data from the background page belonging to the cross-end page subscribed to notifications.
[0013] According to some embodiments of the present disclosure, the transmittable data includes data generated by the operation of the foreground page.
[0014] According to some embodiments of the present disclosure, the timing of obtaining the sendable data of the foreground page published by the foreground page includes one or more of the following: when the foreground page is switched to the background, when a specified time period is reached, or when a specified event is triggered.
[0015] A second aspect of the present disclosure proposes an electronic device, comprising: a memory storing execution instructions; and a processor executing the execution instructions stored in the memory, so that the processor executes the method described in any one of the above embodiments.
[0016] A third aspect of the present disclosure provides a readable storage medium, wherein the readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the method described in any of the above embodiments.
[0017] A fourth aspect of the present disclosure provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it is used to implement the method described in any of the above embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0019] Figure 1-Figure 3 A schematic diagram of the overall flow of a page data processing method M100 according to some embodiments of the present disclosure is shown.
[0020] Figure 4 A schematic diagram showing a native page sending a notification to a cross-end page in some embodiments of the present disclosure.
[0021] Figure 5 A schematic diagram showing some embodiments of the present disclosure of sending notifications from a cross-end page to a native page.
[0022] Figure 6 It is a schematic block diagram of the structure of a page data processing device according to an embodiment of the present disclosure.
[0023] Figure 7 1 is a schematic block diagram of the structure of an electronic device 1000 equipped with a page data processing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0024] The present disclosure is further described in detail below in conjunction with the accompanying drawings and implementations. It is understood that the specific implementations described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.
[0025] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0026] Unless otherwise specified, the exemplary embodiments / embodiments shown will be understood as providing exemplary features of various details of some ways in which the technical concept of the present disclosure can be implemented in practice. Therefore, unless otherwise specified, the features of the various embodiments / embodiments can be combined, separated, interchanged and / or rearranged without departing from the technical concept of the present disclosure.
[0027] The terms used herein are for the purpose of describing specific embodiments, rather than being restrictive. As used herein, unless the context clearly indicates otherwise, the singular forms "one (kind, person)" and "said (the)" are also intended to include plural forms. In addition, when the terms "comprise" and / or "include" and their variations are used in this specification, it is explained that there are stated features, integral bodies, steps, operations, parts, assemblies and / or their groups, but it is not excluded that there are or add one or more other features, integral bodies, steps, operations, parts, assemblies and / or their groups. It should also be noted that, as used herein, the terms "substantially", "approximately" and other similar terms are used as approximate terms and not as degree terms, so that they are used to explain the inherent deviations of the measured values, calculated values and / or provided values that will be recognized by those of ordinary skill in the art.
[0028] For the convenience of description and to make the technical solutions of the specific implementation methods of the present disclosure easier to understand, before describing the page data processing method implemented by the present disclosure, the technical terms involved in the specific implementation methods of the present disclosure are first introduced.
[0029] Native page: A page created based on the design specifications and development tools of the operating system that the page is expected to run on is called a Native page. For example, for an application running on the Android system, its native page is a page developed based on Android.
[0030] Native: refers to native technology, such as iOS, Android, etc. of the terminal.
[0031] Cross-end page: A page developed based on a cross-platform application development framework. A page developed based on Flutter can be called a Flutter page.
[0032] Flutter: It is an open source cross-platform application development framework from Google that can run on multiple platforms and operating systems such as Android and iOS with only one set of code. The official language of Flutter is Dart.
[0033] Plugin: Plugin is a mechanism officially provided by Google, which is a protocol class for encapsulating methodChannel for Flutter to communicate.
[0034] methodChannel: In the Flutter framework, methodChannel is a mechanism for implementing communication between Dart and native platforms (such as Android and iOS).
[0035] Foreground page: refers to the page that the user is currently viewing and interacting with. When the application is in the foreground, the page displayed on the terminal screen is the foreground page, and the application interacts directly with the user through the foreground page.
[0036] Background page: refers to the page that is not displayed on the foreground and is in operation.
[0037] methodChannel: The underlying communication protocol reserved by the Flutter framework for developers. It allows developers to call native platform functions in Flutter applications, or allow the native platform to call methods in Flutter applications.
[0038] As more and more operating systems appear in people's electronic devices, APP (Application) developers need to configure the codes of multiple operating systems on the development side, so that they can be packaged into various APP installation packages suitable for different operating systems, so as to be suitable for running in electronic devices with different operating systems. For some APPs with more functions (such as more complex Internet APPs), the number of notification capabilities required may be larger. When updating the functions of the APP, if the operating system-specific language is used to independently develop the page from the bottom layer for each operating system that needs to be applied, the development cost is high, the development efficiency is low, the requirements for developers are high, and the subsequent maintenance is unsustainable.
[0039] In order to reduce the cost of page development, a cross-platform application development framework (hereinafter referred to as the cross-platform framework) can be used to develop new pages (cross-end pages) in the APP. Among all the pages included in the APP, there may be both native pages and cross-end pages. Native pages are developed using the language of the operating system, and cross-end pages are developed using the cross-platform framework and can run on a variety of different operating systems. At runtime, the cross-end page needs to be able to communicate and interact with the native page.
[0040] In related technologies, data interaction between cross-end pages and native pages needs to be implemented through relatively complex processes and methods, and requires calling multiple different interfaces. The data interaction efficiency is low and the code maintainability is also low.
[0041] To this end, the present disclosure proposes a page data processing method. The page data processing method can be implemented on a terminal device alone. The "terminal device" can be different types of electronic devices, for example, the terminal device can be a mobile phone, a tablet computer, a laptop computer, or a desktop computer.
[0042] Figure 1 FIG. 1 is a schematic diagram showing the overall flow of a page data processing method M100 according to some embodiments of the present disclosure. Figure 1 The method shown includes step S110, step S120, step S130, step S140 and step S150. The method can be executed by electronic devices such as mobile phones and tablet computers.
[0043] S110, constructing a notification receiving and sending channel between the foreground page and the background page. The page types of the foreground page and the background page include cross-end pages and native pages. At least one of the foreground page and the background page is a cross-end page.
[0044] For a multi-page application, a user can open multiple pages of the application in sequence, where the page displayed in the foreground is the foreground page, and the page not displayed and running in the background is the background page. The user can switch between the opened pages at any time, for example, if one of the background pages is switched to the foreground page, the original foreground page can become the background page.
[0045] During the running of the application, based on the needs of the application's own operation or based on some operations performed by the user on the application, data interaction may be required between different pages to ensure the normal operation of the application. For example, two pages A1 and A2 that can perform page routing between each other, when page A1 is the foreground page and page A2 is the background page, the user receives some messages, and the number of messages in page A1 changes. Assume that page A2 also has the function of displaying the number of messages like page A1. If the user operates the application to jump to page A2, page A2 becomes the foreground page, and page A1 becomes the background page, then page A2 needs to display the latest number of messages. Therefore, it is necessary to implement this through data interaction between multiple pages that have been opened. The notification sending and receiving channel is used to provide corresponding service capabilities for data interaction between pages that have been opened. The notification sending and receiving channel can be implemented through a unified API interface.
[0046] All pages contained in the same application may include both cross-end pages and native pages. For example, applications will be continuously updated in the process of technology updates and demand iterations, so when the application is initially developed, it may only contain native pages for one or two operating systems. However, when the number of mainstream operating systems gradually increases, in order to be compatible with these new operating systems, the application can develop cross-end pages during the development of some new pages, so that the application contains both cross-end pages and native pages. For example, if the application runs on the Android system, the native page can be a page implemented in the Java language. When the application runs on different operating systems, the native page is implemented in the corresponding programming language.
[0047] After the user operates the application to open multiple pages in sequence, the opened pages may include one or more cross-end pages. For example, the foreground page is a cross-end page and the background pages are all native pages, or the foreground page is a native page and the background page includes multiple cross-end pages.
[0048] S120, obtaining the sendable data of the foreground page published by the foreground page, wherein the sendable data is used for data interaction between different pages.
[0049] The sendable data may be generated by the user operating the front-end page or by other means. There are usually many types of sendable data, such as user login information, number of unread messages, etc.
[0050] For example, the front page is a login page, and the user enters the user login information including the user name and password on the login page to log in to the account. Since some of the back pages that the user has opened have some page areas for displaying account information, some back pages may need to know the user login information, so that when the user switches to one of these back pages, the page that is switched to can correctly display the user's account information after logging in in the area where the user displays the account information, instead of displaying the information before the user logged in. For example, after the back page obtains the user's login information through notification, it can refresh the page to the logged-in state instead of the visitor state.
[0051] S130: Determine, among the background pages subscribed to notifications, a target page subscribed to a notification type corresponding to the sendable data.
[0052] The above sendable data can be sent through notifications. The background page can express the demand for multiple sendable data by subscribing to notifications. Different sendable data corresponds to different notification types, and the notification type can indicate what kind of sendable data is contained in the notification. Since the developer knows in advance what kind of data the page needs to obtain and what kind of content in the page to refresh, the subscription requirements of different pages are pre-set, and each page can publish the set subscription requirements, so that each page can obtain the subscription requirements of any other page.
[0053] Assume that the current foreground page has sendable data D1, and the notification type corresponding to data D1 is t1. Among the current n background pages, each background page subscribes to notifications, and background pages p1 and p2 both subscribe to notifications of type t1, then p1 and p2 are determined as target pages. When the target page can be determined, the sendable data is the data to be sent. If none of the current n background pages subscribes to notifications of type t1, there is currently no target page, so there is no need to generate notifications to be sent and no need to send notifications.
[0054] S140, generating a to-be-sent notification of the foreground page according to the sendable data.
[0055] If the foreground page and the target page where the subscription has data to send include both native pages and cross-end pages, the sendable data needs to be converted into a format that the target page can recognize. For example, before the Android native page sends a notification to the Flutter cross-end page, the sendable data needs to be converted from the Java language format to the Dart language format to obtain the notification to be sent, so that the Flutter cross-end page can recognize the information and data content contained in the notification to be sent.
[0056] S150, sending a notification to be sent to the target page through a notification sending and receiving channel.
[0057] The front page sends the notification to be sent to the target page through the notification receiving and sending channel between the target page and the front page. After receiving the notification, the target page can refresh its own page content in the background. When the user switches the background page to the front page, the shared controls between the new front page and the original front page can change with the changes in the control content of the original front page, thereby maintaining the linkage of page data and the display of updated data.
[0058] According to the page data processing method proposed in the embodiment of the present disclosure, a cross-end page is adopted when developing the application page. The cross-end page provides a general cross-platform notification capability, can support data interaction with a variety of different terminal platforms (operating systems), and when developing the page, there is no need to develop each notification from the bottom layer. It is only necessary to call a uniformly provided interface (API) to realize the notification sending and receiving and data interaction between the native page and the cross-end page, thereby improving the maintainability and development efficiency of the code.
[0059] Both the cross-end page and the native page can be configured with a corresponding page engine. The front page can publish sendable data through the corresponding page engine. The back page can subscribe to notifications through the corresponding page engine. The back page can include at least one cross-end page. At least some of the cross-end pages in the back page can correspond to a page engine respectively.
[0060] The page engine (Engine, hereinafter referred to as the engine) is a component used to manage and render application pages. All sendable data of the foreground page (native page or cross-end page) must first be obtained by the corresponding page engine, and then notification packaging and notification sending are performed. The background page (native page or cross-end page) needs to receive notifications through the corresponding page engine and render the content in the notification to its own page to refresh the page content.
[0061] The background page contains at least one cross-end page, which means that the user has opened one or more cross-end pages before opening the current foreground page. Among the multiple pages contained in an application, all opened native pages can share the same page engine, and among all opened cross-end pages, each cross-end page can be configured with a dedicated page engine. When multiple background pages correspond to multiple page engines, through the interaction between the page engine of the foreground page and the page engines of each background page, notifications can be sent to multiple background pages to achieve multi-engine support.
[0062] Exemplarily, the page engine of the cross-end page may correspond to a plug-in instance generated based on the cross-platform framework. The plug-in instance is used to perform at least the following steps: determining a target page subscribed to a notification type corresponding to the sendable data in a background page subscribed to notifications (step S130); sending a notification message to the target page through a notification sending and receiving channel (step S150).
[0063] The cross-platform framework can be Flutter or other types of frameworks. A plug-in instance is a created plug-in object that can be used to implement the functions of sending and receiving notifications. A cross-end page can be configured with a page engine, and each engine is configured with independent memory and has an independent life cycle. An engine can be configured with a plug-in instance. A plug-in instance can provide services for multiple notifications. Multiple plug-in instances can be mounted on a cross-end page, and different plug-in instances correspond to different functions.
[0064] The life cycle of the plug-in instance can be greater than or equal to the life cycle of the cross-end page. For example, the plug-in instance of the new page (cross-end page) can be created at the beginning of the life cycle of the new page (when the page is opened), and can be destroyed at the end of the life cycle of the new page (when the page is destroyed). In addition to step S130 and step S150, step S120 and step S140 can also be performed by the plug-in instance.
[0065] Figure 2 FIG. 1 is a schematic diagram showing the overall flow of a page data processing method M100 according to some other embodiments of the present disclosure. Figure 2Before constructing the notification receiving and sending channel between the foreground page and the background page (step S110), the page data processing method M100 may first execute steps S101 and S102.
[0066] S101, in response to receiving a page opening instruction, opening a new page, wherein the new page forms a foreground page when opened, and the new page does not belong to any type of background page.
[0067] When a user is operating an application with n types of pages, if he clicks a button to jump to a page that is not a background page, then the page is a new page and is displayed in the foreground after being opened, so it is a foreground page at this time. If the page jumps to a background page, it does not belong to opening a new page, but opening a background page.
[0068] S102: If the new page is a cross-end page, the page engine of the new page is added to the plug-in management class, and the specified subscribed notification type of the new page is provided to the page engine of the background page. The page engine of the cross-end page has the ability to send and receive notifications with other pages through the method provided by the plug-in management class.
[0069] When a user opens a new cross-end page, the application creates a page engine to render the new page and adds the page engine to the plug-in management class. A plug-in instance can be formed in the process of creating the page engine. After the engine is added to the plug-in management class, the plug-in instance can start to monitor the notification channel provided by the native page and provide the notifications required by the new cross-end page. The monitoring notification channel can be used to receive notifications from the foreground page and send them to the background page corresponding to the plug-in itself. Providing the notification types required by itself can enable other pages to query these notification types when they become the foreground page, so that the corresponding notifications can be sent over.
[0070] For cross-end pages (cross-platform side, such as Flutter), notifications can be sent and received through the classes developed externally on the cross-platform side. For example, use the post method to send notifications to native pages and other cross-end pages, use the subscribe method to subscribe to notifications from native pages, and use the unsubscribe method to unsubscribe.
[0071] Since a notification can have multiple subscription objects (pages), a map object can be used to store subscription objects. In the map object, the key is the name of the subscription object, such as the page ID or engine ID, and the value can be a list list. The items contained in the list can include the description of the active subscription observer. The description content can include the callback event callBack after the subscription is successful and the hash hash of the subscription object, as well as the most basic unit of the notification event. This most basic unit is the basic unit for implementing notification data transmission, including the name of the notification, the object obj passed by the notification, and the custom dictionary type map carried by the notification. The name of the notification can be a unique name created before the page engine of the new cross-end page is added to the plug-in management class.
[0072] For native pages (native platform side, such as Android), you can call the notification API interface to call the post method to send a cross-platform notification, call the subcribe method to subscribe, and call the unsubscrube method to unsubscribe. Among them, the post method can send a notification channel to the plug-in instance, so that the plug-in instance of the cross-end page monitors this notification channel, and sends the notification of the native page to the cross-end page corresponding to the instance itself through monitoring.
[0073] Continue reading Figure 2 , the page data processing method M100 may further perform the following step S160.
[0074] S160, in response to receiving the page destruction instruction, removing the page engine of the to-be-destroyed page from the plug-in management class, and stopping the to-be-destroyed page from providing the specified subscribed notification type to the page engines of other pages.
[0075] When the user closes the foreground page while it is running in the foreground, or closes the background page while it is running in the background, it is equivalent to making a page destruction instruction. When a page is destroyed, the page does not need to interact with other pages. Therefore, the page engine is removed and the subscription demand is canceled. Other pages will not query the subscription demand of the page and mistakenly send notifications to non-existent pages.
[0076] Figure 3 FIG. 1 is a schematic diagram showing the overall flow of a page data processing method M100 according to some other embodiments of the present disclosure. Figure 3 In step S130, the step of determining, in the background page subscribed to the notification, a target page subscribed to the notification type corresponding to the sendable data may include the following step S131.
[0077] S131, traverse the page engines of the background pages belonging to the cross-end page, and determine the target page subscribed to the notification type corresponding to the sendable data from the background pages belonging to the cross-end page that subscribe to the notification.
[0078] When the background page contains multiple cross-end pages, there may be multiple engines because each cross-end page can correspond to an engine. In this case, the engines can be traversed and the subscription requirements of each engine can be identified to determine whether there is a background page (i.e., target page) that needs to subscribe to the current sendable data of the front-end page, and which background pages subscribe to the current sendable data of the front-end page. If the front-end page is a native page at this time, the methodChannel mechanism is needed to realize the interaction between the native side and the cross-platform side.
[0079] The sendable data may include data generated by the front page being operated. The timing of obtaining the sendable data of the front page published by the front page may include one or more of the following: when the front page is switched to the background, when a specified time period is reached, when a specified event is triggered.
[0080] For example, the user login information may be data generated when the front-end page is operated (input) by the user. When the user clicks the login button and logs in successfully, the login success event belonging to the specified event is triggered, and the page engine obtains the user login information, and then traverses the subscription requirements and sends notifications, so that other pages become logged in.
[0081] For another example, when a user selects a filter condition in the foreground page (such as clicking a checkbox), when the user returns to a background page, the selected filter condition may be the data that can be sent when the foreground page that is about to return to the background is switched to the background. When the foreground page is switched to the background, the user's selected filter condition is obtained, and then the subscription requirements are traversed and notifications are sent, thereby continuing the user's selected filter condition.
[0082] Figure 4 A schematic diagram showing a native page sending a notification to a cross-end page in some embodiments of the present disclosure is shown. Figure 4, Native represents the native page, OS1 represents the operating system corresponding to the native page (such as Android, iOs, etc.), N represents notification, and N1~N5 correspond to 5 different notifications respectively. Flutter represents the cross-end page, page1 and page2 are two different cross-end pages, s represents the business, and s1~s5 correspond to 5 different businesses respectively. Plugins represents the plug-in instance of the cross-end page, which is the communication bridge between the native page and the cross-end page. A cross-end page corresponds to an engine, and an engine corresponds to a plug-in instance plugin. Plugin1 is the plug-in instance of page1, and plugin2 is the plug-in instance of page2. post represents notification publishing, and subscribe represents notification subscription.
[0083] Figure 4 In the example, the new page is a native page. The user operates on the native page and forms five types of sendable data in sequence. The five types of sendable data correspond to notifications N1 to N5. The cross-end pages page1 and page2 are all the current background pages, of which page1 subscribes to notifications N1 to N3, and page2 subscribes to notifications N4 and N5.
[0084] When the native page forms sendable data containing user login information, the engine of the native page can determine what kind of notifications each cross-end page has subscribed to from the engines of the two cross-end pages. When it is identified that the notification N1 corresponding to the formed user login information is only subscribed by the engine of the cross-end page page1, the sendable data (i.e., the data to be sent) is packaged to form notification N1, and then notification N1 is published to the plug-in instance plugin1 through the post method. The information of notification N1 is sent to the engine of page1 through plugin1, and the engine of page1 refreshes the page content of page1 through the user login information contained in notification N1. When the user switches to page1 later, the user login information can be displayed on page1.
[0085] When the native page forms sendable data containing the number of unread messages, the engine of the native page can determine what kind of notifications each cross-end page has subscribed to from the engines of the two cross-end pages. When it is identified that the notification N5 corresponding to the number of unread messages formed is only subscribed by the engine of the cross-end page page2, the sendable data (i.e., the data to be sent) is packaged to form notification N5, and then notification N5 is published to the plug-in instance plugin2 through the post method. The information of notification N5 is sent to the engine of page2 through plugin2, and the engine of page2 refreshes the page content of page2 through the number of unread messages contained in notification N2. When the user switches to page2 later, the number of unread messages can be displayed on page2.
[0086] It is understandable that if the notification corresponding to the sendable data formed in the foreground native page is subscribed by multiple cross-end pages at the same time, or even by multiple cross-end pages and multiple native pages at the same time, the engine of the foreground native page will refresh the native page subscribed to the notification, and form the sendable data into a notification and send it to the subscribed multiple cross-end pages. The cross-end page in the background page, as a currently invisible cross-end page, can receive notifications from the native page to achieve multi-engine support.
[0087] Figure 5 A schematic diagram showing a cross-end page sending a notification to a native page in some embodiments of the present disclosure is shown. Figure 5 , the new page page1 is a cross-end page, and the background page only contains multiple native pages. When the user operates on the cross-end page page1 and forms sendable data, the data is sent to its own plug-in instance plugin1, and plugin1 determines the native page that has subscribed to the corresponding notification from multiple background native pages, and then sends the notification.
[0088] The code of the native page can contain the code of multiple operating systems. For example, OS1 and OS2 represent two different operating systems. If the application is currently installed on a terminal using OS1, the cross-terminal page interacts with the native page of OS1, and the native page of OS2 does not exist in the application. However, for different operating systems, the notifications subscribed to by the same native page can be the same, such as Figure 5 As shown, the pages of OS1 and OS2 both include two subscription services, s1 and s2, which have notification N1.
[0089] Taking Flutter as an example, the plugin module of the Flutter page can contain dart code modules, iOS modules, Android modules, and Harmony modules, so that the Flutter page can run on iOS, Android, and Harmony operating systems. These modules can each implement the methodChannel protocol, and the difference lies in the programming language model used by different modules. It is understandable that the plugin module can also contain modules of other operating systems.
[0090] Based on any of the above implementations, the present disclosure also provides a page data processing device, corresponding to a page data processing method.
[0091] Figure 6 FIG. 1 is a schematic block diagram of the structure of a page data processing device according to an embodiment of the present disclosure. Figure 6As shown, the page data processing device includes: a channel construction module 1002 , a data acquisition module 1004 , a page determination module 1006 , a notification generation module 1008 and a notification sending module 1010 .
[0092] The channel construction module 1002 is used to construct a notification sending and receiving channel between the foreground page and the background page. Among them, the page types of the foreground page and the background page include cross-end pages and native pages. At least one page of the foreground page and the background page is a cross-end page.
[0093] The data acquisition module 1004 is used to acquire the sendable data of the foreground page published by the foreground page, wherein the sendable data is used for data interaction between different pages.
[0094] The page determination module 1006 is used to determine, among the background pages subscribed to notifications, a target page subscribed to a notification type corresponding to the sendable data.
[0095] The notification generation module 1008 is used to generate a notification to be sent on the front page according to the sendable data.
[0096] The notification sending module 1010 is used to send a notification to be sent to a target page through a notification sending and receiving channel.
[0097] The above modules can be implemented by computer program modules. The implementation process of the functions and effects of each module in the above device is specifically described in the implementation process of the corresponding steps in the above method, which will not be repeated here.
[0098] The execution subject of the page data processing method in the specific implementation manner of the present disclosure may be an electronic device such as a mobile phone, a tablet computer, or a server.
[0099] Therefore, based on any of the above embodiments, the present disclosure further provides an electronic device, which can execute the page data processing method of any of the embodiments described above in the present disclosure, and the page data processing device of any of the embodiments described above can be configured on the electronic device.
[0100] Figure 7 FIG. 1 is a schematic block diagram of an electronic device 1000 equipped with a page data processing device according to an embodiment of the present disclosure. Figure 7 The page data processing device includes: a channel construction module 1002, a data acquisition module 1004, a page determination module 1006, a notification generation module 1008 and a notification sending module 1010.
[0101] The channel construction module 1002 is used to construct a notification sending and receiving channel between the foreground page and the background page. Among them, the page types of the foreground page and the background page include cross-end pages and native pages. At least one page of the foreground page and the background page is a cross-end page.
[0102] The data acquisition module 1004 is used to acquire the sendable data of the foreground page published by the foreground page, wherein the sendable data is used for data interaction between different pages.
[0103] The page determination module 1006 is used to determine, among the background pages subscribed to notifications, a target page subscribed to a notification type corresponding to the sendable data.
[0104] The notification generation module 1008 is used to generate a notification to be sent on the front page according to the sendable data.
[0105] The notification sending module 1010 is used to send a notification to be sent to a target page through a notification sending and receiving channel.
[0106] The above modules can be implemented by computer program modules. The implementation process of the functions and effects of each module in the above device is specifically described in the implementation process of the corresponding steps in the above method, which will not be repeated here.
[0107] The hardware structure of the electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, memory 1300 and / or hardware modules together. The bus 1100 can also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc.
[0108] The bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the figure only uses one connecting line, but does not mean that there is only one bus or one type of bus.
[0109] The processor 1200 may be a central processing unit (CPU). The processor 1200 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0110] The memory 1300 can be used as a non-transitory computer-readable storage medium, and can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions of the computer program in the embodiment of the present disclosure. The processor 1200 implements the page data processing method by running the non-transitory software programs, instructions and modules stored in the memory 1300.
[0111] The memory 1300 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created by the processor 1200, such as structural data, model data, sample data, stiffness evaluation results, etc. of the bridge. In addition, the memory 1300 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 1300 may optionally include a memory remotely arranged relative to the processor 1200, and these remote memories may be connected to the processor 1200 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0112] The present disclosure also provides a readable storage medium, in which a computer program is stored, and the computer program is used to implement the above method when executed by a processor. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use in an instruction execution system, device or equipment or in combination with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion (electronic device) with one or more wirings, a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.
[0113] The present disclosure also provides a computer program product, and the method of the present disclosure can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed, the process or function of the present disclosure is executed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device, a core network device, an OAM or other programmable device.
[0114] The computer program or instructions may be stored in a readable storage medium or transmitted from one readable storage medium to another readable storage medium, for example, the computer program or instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The readable storage medium may be any available medium that can be accessed or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disk; it may also be a semiconductor medium, such as a solid state drive. The computer readable storage medium may be a volatile or non-volatile storage medium, or may include both volatile and non-volatile types of storage media.
[0115] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0116] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0117] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0119] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" etc. means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in any one or more embodiments / methods or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and features of different embodiments / methods or examples, unless they are contradictory.
[0120] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0121] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.
Claims
1. A page data processing method, characterized in that: include: Constructing a notification sending and receiving channel between a foreground page and a background page, wherein the page types of the foreground page and the background page include cross-end pages and native pages, and at least one of the foreground page and the background page is the cross-end page; Acquire the sendable data of the foreground page published by the foreground page, wherein the sendable data is used for data interaction between different pages; Determining, in the background page subscribed to notifications, a target page subscribed to a notification type corresponding to the sendable data; Generate a notification to be sent of the front-end page according to the sendable data; as well as The notification to be sent is sent to the target page through the notification sending and receiving channel.
2. The page data processing method according to claim 1, characterized in that: The cross-end page and the native page are both configured with corresponding page engines, the foreground page publishes the sendable data through the corresponding page engine, and the background page subscribes to notifications through the corresponding page engine.
3. The page data processing method according to claim 2, characterized in that: The background page includes at least one cross-end page, and at least some of the cross-end pages in the background page correspond to one of the page engines respectively.
4. The page data processing method according to claim 2 or 3, characterized in that: The page engine of the cross-end page corresponds to a plug-in instance generated based on a cross-platform framework, and the plug-in instance is used to perform at least the following steps: The step of determining, in the background page subscribed to notifications, a target page subscribed to a notification type corresponding to the sendable data; The step of sending the notification to be sent to the target page through the notification sending and receiving channel.
5. The page data processing method according to claim 4, characterized in that: The life cycle of the plug-in instance is greater than or equal to the life cycle of the cross-end page.
6. The page data processing method according to any one of claims 1 to 3, characterized in that: Before constructing the notification sending and receiving channel between the foreground page and the background page, the method further includes: In response to receiving a page opening instruction, opening a new page, wherein the new page forms a foreground page when opened, and the new page does not belong to any of the background pages; and If the new page is a cross-end page, the page engine of the new page is added to the plug-in management class, and the specified subscribed notification type of the new page is provided to the page engine of the background page. The page engine of the cross-end page has the ability to send and receive notifications with other pages through the method provided by the plug-in management class.
7. The page data processing method according to claim 6, characterized in that: The method further comprises: In response to receiving the page destruction instruction, the page engine of the to-be-destroyed page is removed from the plug-in management class, and the to-be-destroyed page stops providing the specified subscribed notification type to the page engines of other pages.
8. The page data processing method according to any one of claims 1 to 3, characterized in that: Determining, in the background page subscribed to notifications, a target page subscribed to a notification type corresponding to the sendable data, comprises: The page engines of the background pages belonging to the cross-end page are traversed, and a target page subscribed to a notification type corresponding to the sendable data is determined from the background pages belonging to the cross-end page that subscribe to notifications.
9. The page data processing method according to claim 1, characterized in that: The transmittable data includes data generated by the operation of the foreground page.
10. The page data processing method according to claim 9, characterized in that: The timing of obtaining the sendable data of the foreground page published by the foreground page includes one or more of the following: when the foreground page is switched to the background, when a specified time period is reached, and when a specified event is triggered.
11. An electronic device, characterized in that: include: A memory storing execution instructions; as well as A processor, wherein the processor executes the execution instruction stored in the memory, so that the processor executes the method according to any one of claims 1 to 10.
12. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program is used to implement the method according to any one of claims 1 to 10.