Data response method and device in system platform and electronic equipment

CN115705212BActive Publication Date: 2026-08-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110904099.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-06
Publication Date
2026-08-21
Estimated Expiration
2041-08-06

AI Technical Summary

Technical Problem

[0003]在相关技术提供的方案中,为了实现应用程序对不同系统平台的适配,通常是从头创造一整套和各系统平台原生开发不同的运行时架构,采用各种自渲染引擎,抛弃系统平台原生的视觉风格及交互效果,这就导致应用程序的开发方式与各系统平台的原生开发方式差距极大,应用程序的运行性能相较于原生开发来说也存在不同程度的下降

Benefits of technology

在接收到针对响应式数据的更新操作时,对响应式数据进行更新处理,并通过与更新后的响应式数据存在订阅关系的目标程序对象来实现对更新操作的响应,由于程序对象能够支持在多种系统平台中运行,因此能够在不改变系统平台原生底层机制的基础上实现数据响应,提升数据响应的相关性能(如响应效率),同时也可以适配不同的系统平台;此外,数据响应是通过显示目标系统平台的原生视图控件来实现的,因此能够保留目标系统平台原生的视觉风格及交互效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115705212B_ABST
    Figure CN115705212B_ABST
Patent Text Reader

Abstract

The application provides a data response method and device in a system platform, electronic equipment and a computer readable storage medium. The method comprises: in response to an update operation on responsive data, updating the responsive data; selecting a target program object from a plurality of program objects that has a subscription relationship with the updated responsive data; each program object supports running in multiple system platforms; running the target program object, and in the running process, assigning a native view control of a target system platform according to the updated responsive data, and displaying the assigned native view control in a user interface. Through the application, different system platforms can be adapted, native support of the system platform is realized, and the related performance of data response is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to computer technology, and more particularly to a data response method, apparatus, electronic device, and computer-readable storage medium in a system platform. Background Technology

[0002] With the rapid development of computer technology, various system platforms have emerged, the most common being mobile (mainly iOS and Android) and desktop (mainly Windows and macOS). These four system platforms have highly similar functions, but due to differences in development languages ​​and environments, they often require four separate teams to develop applications for deployment on each platform.

[0003] In the solutions provided by related technologies, in order to achieve application adaptation to different system platforms, a completely different runtime architecture is usually created from scratch and developed from the native development of each system platform. Various self-rendering engines are used, and the native visual style and interactive effects of the system platform are abandoned. This results in a huge gap between the application development method and the native development method of each system platform, and the running performance of the application is also reduced to varying degrees compared with native development. Summary of the Invention

[0004] This application provides a data response method, apparatus, electronic device, and computer-readable storage medium in a system platform, which can be adapted to different system platforms, achieve native support of the system platform, and improve the relevant performance of data response.

[0005] The technical solution of this application embodiment is implemented as follows: This application provides a data response method in a system platform, applied to a target system platform, wherein the target system platform is any one of a variety of system platforms; the method includes: In response to an update operation on the responsive data, the responsive data is updated. Select target program objects from multiple program objects that have a subscription relationship with the updated responsive data; wherein each program object supports running on the multiple system platforms; Run the target program object, and during runtime, allocate and process the native view controls of the target system platform according to the updated responsive data. Display the assigned native view controls in the user interface.

[0006] This application provides a data response device in a system platform, applied to a target system platform, wherein the target system platform is any one of a variety of system platforms; the device includes: An update module is used to update the responsive data in response to an update operation on the responsive data. A filtering module is used to filter out target program objects that have a subscription relationship with the updated responsive data from multiple program objects; wherein each program object supports running on the multiple system platforms; The response module is used to run the target program object. During the operation, it allocates and processes the native view controls of the target system platform according to the updated responsive data, and displays the allocated native view controls in the user interface.

[0007] This application provides an electronic device, including: Memory, used to store executable instructions; The processor, when executing executable instructions stored in the memory, implements the data response method in the system platform provided in the embodiments of this application.

[0008] This application provides a computer-readable storage medium storing executable instructions for inducing a processor to execute and implement the data response method in the system platform provided in this application.

[0009] The embodiments of this application have the following beneficial effects: When an update operation is received for responsive data, the responsive data is updated, and the response to the update operation is achieved through a target application object that has a subscription relationship with the updated responsive data. Since the application object can run on multiple system platforms, data response can be achieved without changing the native underlying mechanism of the system platform, thereby improving the relevant performance of data response (such as response efficiency) and adapting to different system platforms. In addition, data response is achieved by displaying the native view controls of the target system platform, thus preserving the native visual style and interactive effects of the target system platform. Attached Figure Description

[0010] Figure 1 This is a schematic diagram of the architecture of the data response system in the system platform provided in the embodiments of this application; Figure 2 This is a schematic diagram of the architecture of the terminal device provided in the embodiments of this application; Figure 3A This is a flowchart illustrating the data response method in the system platform provided in this application embodiment; Figure 3B This is a flowchart illustrating the data response method in the system platform provided in this application embodiment; Figure 3CThis is a flowchart illustrating the data response method in the system platform provided in this application embodiment; Figure 4 This is a schematic diagram of the virtual view tree provided in an embodiment of this application; Figure 5 This is a schematic diagram of the client development framework provided in an embodiment of this application; Figure 6 This is a schematic diagram illustrating the establishment of a subscription relationship provided in an embodiment of this application; Figure 7 This is a schematic diagram of data-driven implementation provided in an embodiment of this application; Figure 8 This is a schematic diagram of the interface layout and on-screen display provided in the embodiments of this application; Figure 9A This is a schematic diagram of the user interface in the iOS system platform provided in the embodiments of this application; Figure 9B This is a schematic diagram of the user interface in the Android system platform provided in the embodiments of this application; Figure 9C This is a schematic diagram of the user interface in the macOS system platform provided in the embodiments of this application; Figure 9D This is a schematic diagram of the user interface in the Windows system platform provided in the embodiments of this application. Detailed Implementation

[0011] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0012] In the following description, references to "some embodiments" describe a subset of all possible embodiments; however, it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict. In the following description, the term "a plurality of" means at least two.

[0013] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0014] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0015] 1) Computing Platform: refers to the system environment in an electronic device that supports the operation of applications. In this application embodiment, different system platforms can be distinguished by the operating system, which includes but is not limited to iOS, Android, macOS and Windows.

[0016] 2) Responsive Data: When data changes, a series of related operations can be triggered according to set rules. This type of data is called responsive data, which can be understood as data that is "alive". In the embodiments of this application, responsive data is used to realize data response (or data-driven).

[0017] 3) Program object: Generally refers to code written in a common programming language that is natively supported by multiple system platforms. Therefore, the program object can run on multiple system platforms. For example, for iOS, Android, macOS, and Windows platforms, the common programming language could be C++. This application does not limit the functionality of the program object; for example, it could be used to display specific native view controls.

[0018] 4) Native View Controls: These are view controls natively supported by the system platform. They can be displayed seamlessly using the platform's capabilities. For example, native view controls can be defined during the operating system's design process and can be directly displayed through the operating system. For instance, for iOS, Android, Windows, and macOS, the native view controls used to display labels are UILabel, TextView, ClabelUI, and NSTextField, respectively. Before using native view controls, they need to be created. When no longer needed, they can be deleted to save storage space.

[0019] 5) Virtual View Tree: This tree records several components and the relationships (such as order) between them. The components simulate native view controls in the system platform, meaning they have a mapping relationship (correspondence) with native view controls. Since directly performing calculations on native view controls involves excessive computation, this embodiment constructs a virtual view tree, performs calculations on the components within the virtual view tree, and finally maps the components to native view controls. This saves computational load during data response and reduces performance requirements for electronic devices.

[0020] For different system platforms, related technologies offer cross-platform solutions, such as Electron and Flutter. However, these solutions create a completely different runtime architecture from the native development of each system platform, using various self-rendering engines and abandoning the native visual style and interactive effects of the system platform. This results in a significant gap between these solutions and the native development methods of each system platform, further leading to the following problems: 1) The package size of the generated application is significantly increased, its simplicity is poor, and it is not conducive to deployment on various system platforms; 2) The running performance of the application is reduced to varying degrees compared with native development; 3) The application contains a large amount of glue code for cross-language communication; 4) Debugging is troublesome and inefficient; 5) The learning and migration costs are very high.

[0021] This application provides a data response method, apparatus, electronic device, and computer-readable storage medium for a system platform. These methods are adaptable to different system platforms, enabling data response without altering the platform's underlying mechanisms, thus improving data response performance while preserving the platform's original visual style and interactive effects. The following describes exemplary applications of the electronic device provided in this application. This electronic device can be implemented as various types of terminal devices or as a server.

[0022] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the data response system 100 in the system platform provided in this application embodiment. The terminal device 400 is connected to the server 200 through the network 300, wherein the network 300 can be a wide area network or a local area network, or a combination of the two.

[0023] In some embodiments, taking the electronic device as a terminal device as an example, the data response method in the system platform provided in this application embodiment can be implemented by the terminal device. For example, when the terminal device 400 receives an update operation for responsive data (e.g., an update operation triggered by a user), it updates the responsive data; it filters out target program objects from multiple program objects that have a subscription relationship with the updated responsive data; it runs the target program object, and during the running process, it allocates native view controls of the target system platform according to the updated responsive data, and displays the allocated native view controls in the user interface. Here, the target system platform refers to the system platform of the terminal device 400, and each program object supports running on multiple system platforms. As an example, in Figure 1 The user interface shows native view control 1 and native view control 2.

[0024] It is worth noting that the responsive data and multiple program objects mentioned above can be integrated into the application. The terminal device 400 can deploy the application to achieve data response in the target system platform. Deployment can be done by downloading and installing, but the deployment method is not limited to this.

[0025] In some embodiments, the data response method in the system platform provided in this application can also be implemented collaboratively by a terminal device and a server. For example, server 200 can send an application integrating responsive data and multiple program objects to terminal device 400. After deploying the application, terminal device 400 can implement data response in its own target system platform. For application developers, they can use server 200 to develop applications, or they can use other electronic devices (such as terminal devices or servers) to develop applications and store the developed applications on server 200. It is worth noting that the application development work includes, but is not limited to, setting responsive data, setting program objects, and setting subscription relationships.

[0026] In some embodiments, various results involved in the data response process (such as responsive data, program objects, applications integrating responsive data and multiple program objects, etc.) can be stored in a blockchain. Because of the immutable nature of the blockchain, the accuracy of the data in the blockchain can be guaranteed. Electronic devices can send query requests to the blockchain to retrieve data stored in the blockchain.

[0027] In some embodiments, the terminal device 400 or server 200 can implement the data response method in the system platform provided in this application embodiment by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP), that is, a program that needs to be installed in the operating system to run, such as the client 510 mentioned above; it can also be a small program, that is, a program that only needs to be downloaded to the browser environment to run; or it can be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plugin.

[0028] In some embodiments, server 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The cloud services can be application services that are invoked by terminal device 400 to allow terminal device 400 to access applications. Terminal device 400 can be a smartphone, tablet, laptop, desktop computer, smart TV, smartwatch, etc., but is not limited to these. Terminal devices and servers can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.

[0029] Taking the example of a terminal device provided in this application embodiment, it can be understood that in the case where the electronic device is a server, Figure 2 Some parts of the structure shown (such as the user interface, presentation module, and input processing module) can be omitted. See also Figure 2 , Figure 2 This is a schematic diagram of the structure of the terminal device 400 provided in the embodiments of this application. Figure 2 The terminal device 400 shown includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the terminal device 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 440.

[0030] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0031] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0032] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.

[0033] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.

[0034] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.

[0035] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc. Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 associated with user interface 430 (e.g., a display screen, a speaker, etc.). The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.

[0036] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2 A data response device 455 in a system platform stored in memory 450 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: an update module 4551, a filtering module 4552, and a response module 4553. These modules are logically connected and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.

[0037] The data response method in the system platform provided in the embodiments of this application will be described in conjunction with exemplary applications and implementations of the electronic devices provided in the embodiments of this application.

[0038] See Figure 3A , Figure 3A This is a flowchart illustrating a data response method in a system platform provided in this application embodiment. This method can be executed by an electronic device and will combine... Figure 3A The steps shown are explained.

[0039] In step 101, the responsive data is updated in response to the update operation for the responsive data.

[0040] The embodiments of this application can be applied to a variety of system platforms. For ease of understanding, the target system platform in a certain electronic device is used as an example for illustration. The target system platform can be any one of the various system platforms.

[0041] Electronic devices store responsive data and multiple program objects. These program objects are written in a programming language common to multiple system platforms, thus enabling them to run on various system platforms. Electronic devices can implement data responses on a target system platform based on responsive data and multiple program objects. An example will follow.

[0042] First, when an electronic device receives an update operation for responsive data, it updates the responsive data. This update operation can be received within the user interface; for example, if the user interface displays responsive data, then an update operation for that responsive data can be received. Alternatively, if the user interface displays a native view control corresponding to the responsive data, then an update operation for that native view control can be used as an update operation for the responsive data.

[0043] It is worth noting that the embodiments of this application do not limit the type of update operation. For example, it can be a touch operation (such as clicking, long pressing, swiping, etc.) or a non-touch operation (such as voice input, gesture input, etc.).

[0044] It is worth noting that the update process is used to update the data value of the responsive data, for example, updating the data value of the responsive data from 1 to 2. The update process does not affect the subscription relationship related to the responsive data. In addition, the embodiments of this application do not limit the amount of responsive data.

[0045] In some embodiments, before step 101, the method further includes: running a message encapsulation program object among multiple program objects to trigger a message loop in the target system platform; wherein the message encapsulation program object is obtained by encapsulating message program objects corresponding to multiple system platforms respectively; wherein the message loop is used to perform message transmission with the target system platform, and the messages transmitted by the message loop include update operations.

[0046] In this embodiment, data response can be implemented through the message loop mechanism in the target system platform. For example, multiple encapsulated message program objects can be run to trigger the message loop in the target system platform during the execution of the encapsulated message program objects. This message loop is used for message transmission with the target system platform. The encapsulated message program objects are obtained by encapsulating message program objects corresponding to various system platforms, thus supporting execution on multiple system platforms. The messages transmitted by the message loop include at least update operations for reactive data.

[0047] In this embodiment, responsive data and multiple program objects can be integrated into an application, and the electronic device deploys the application. In this case, the message loop triggered by the encapsulated message program object is essentially used for message transmission between the application and the target system platform. For example, when the target system platform receives an update operation for responsive data, it sends the update operation to the application through the message loop so that the application can respond to the data.

[0048] The above methods can meet the message-driven characteristics of the target system platform, enable effective communication with the target system platform, and thus achieve accurate data response.

[0049] In step 102, target program objects that have a subscription relationship with the updated responsive data are selected from multiple program objects; wherein each program object supports running on multiple system platforms.

[0050] Here, program objects that have a subscription relationship with the updated reactive data are selected from multiple program objects. For easy distinction, the selected program objects are named target program objects. The subscription relationship between reactive data and program objects can be pre-established and stored. A piece of reactive data can have a subscription relationship with one or more program objects, depending on the actual application scenario.

[0051] In some embodiments, when the number of target program objects is zero, the updated reactive data is deleted.

[0052] Here, when no program objects with a subscription relationship to the updated responsive data are found, i.e., the number of target program objects is zero, the updated responsive data can be directly deleted, thereby saving storage space on electronic devices and avoiding invalid data responses.

[0053] In step 103, the target program object is run. During the run, the native view controls of the target system platform are allocated and processed according to the updated responsive data, and the allocated native view controls are displayed in the user interface.

[0054] Here, the target program object runs on the target system platform. During the execution of the target program object, the native view controls of the target system platform are allocated based on the updated responsive data. That is, which native view controls(s) need to be displayed are selected, and finally, the allocated native view controls are displayed in the user interface. The allocation logic of the native view controls can be set according to the actual application scenario.

[0055] By displaying the assigned native view controls in the user interface, it is possible to respond to update operations and interact with the user. At the same time, the native view controls are natively supported by the target system platform, thus preserving the native visual style and interactive effects of the target system platform and improving the user experience.

[0056] It is worth noting that the data response logic of the target program object is not limited to allocating native view controls. For example, it can also be to display updated responsive data in the user interface (such as displaying data values), or to perform further calculations on the updated responsive data, depending on the actual application scenario.

[0057] In some embodiments, after step 102, the method further includes: adding the target program object to the list to be run; when there are multiple target program objects, the above-mentioned running of the target program objects can be achieved in the following way: according to the creation order of the multiple target program objects in the list to be run, the multiple target program objects are run sequentially.

[0058] For example, for updated reactive data, the corresponding target program object can be added to a list to be run, ready for subsequent execution. Here, when there are multiple updated reactive data sets (e.g., receiving update operations for multiple reactive data sets in a message loop), the target program objects corresponding to each of the multiple updated reactive data sets can be added to the same list to be run. Specifically, when different updated reactive data sets correspond to the same target program object, the operation of adding that same target program object to the list to be run only needs to be performed once. That is, the list to be run includes distinct target program objects, thus avoiding unnecessary duplicate additions and saving computational resources.

[0059] Before the next message loop begins in the current message loop, multiple target program objects can be run sequentially according to their creation order in the list of objects to be run. For example, multiple target program objects in the list can be run sequentially according to their creation time from earliest to latest. This ensures the accuracy of the runtime of the target program objects and improves the orderliness of data response.

[0060] In some embodiments, during the execution of the target program object, the method further includes: performing function operations on the updated reactive data to obtain a return data value; wherein the return data value is used to be invoked by a program object that has a subscription relationship with the target program object.

[0061] In this application embodiment, program objects can be divided into two categories: those with return values ​​and those without return values. Program objects without return values ​​are like the target program object in step 103. Program objects with return values ​​can have dual identities: they can actively subscribe to responsive data and can also be used as responsive data to be subscribed to by other program objects.

[0062] Taking the target program object as an example, during its execution, the updated reactive data can be processed by functions to obtain a return data value. The method of function processing is not limited; for example, it could be multiplying the updated reactive data value (the target data value) by 2 to obtain the return data value. The return data value obtained by the target program object during its execution can be called by other program objects, where these other program objects have a subscription relationship with the target program object, meaning they are subscribed to the target program object as reactive data. This approach enhances the diversity and scalability of data responses, facilitating expansion to more application scenarios.

[0063] In some embodiments, after step 103, the method further includes: in response to a triggering operation on an assigned native view control, running a function jumper object among a plurality of program objects to display the execution process of the native function in the user interface.

[0064] After the assigned native view control is displayed, trigger operations can be received for the assigned native view control through the user interface. When the assigned native view control corresponds to a native function of the target system platform, upon receiving a trigger operation for the assigned native view control, function jump program objects within multiple program objects can be run. During the execution of the function jump program object, the execution process of the native function is displayed on the user interface.

[0065] Native functionality refers to functionality natively developed based on the target system platform, such as the function of displaying text or playing video. This application does not limit this. When switching the content displayed in the user interface from the assigned native view control to the execution process of the native function, it can be achieved through switching methods such as context, push, pop, present, or dismiss. This is not limited.

[0066] It is worth noting that the embodiments of this application do not limit the type of triggering operation involved. For example, it can be a touch operation (such as clicking, long pressing, swiping, etc.) or a non-touch operation (such as voice input, gesture input, etc.).

[0067] In this way, the data response mechanism provided in the embodiments of this application can be combined with the native functions of the target system platform to achieve flexible switching and improve the applicability to different application scenarios.

[0068] like Figure 3A As shown, the embodiments of this application can achieve data response without changing the native underlying mechanism of the system platform, improve the relevant performance of data response (such as response efficiency), and can also adapt to different system platforms, reducing development difficulty. In addition, data response is achieved by displaying the native view control of the target system platform, thus preserving the native visual style and interactive effects of the target system platform and improving the user experience.

[0069] In some embodiments, see Figure 3B , Figure 3B This is a flowchart illustrating a data response method in a system platform provided in this application embodiment, which can be executed by an electronic device. Figure 3B middle, Figure 3A Step 103 shown can be implemented through steps 201 to 204, which will be explained in conjunction with each step.

[0070] In step 201, the target program object is run. During the run, multiple components included in the target program object are filtered based on the updated responsive data to obtain the target component.

[0071] Here, the target application object includes multiple components, each corresponding to a native view control in the target system platform. During the execution of the target application object, the multiple components included in the target application object can be filtered based on the updated responsive data to obtain the target components. The number of target components is not limited and can be one or more.

[0072] In some embodiments, the updated responsive data value (target data value) can be used to determine whether each component in the target application object needs to be displayed. Here, the displayed component refers to the native view control corresponding to the displayed component. For example, if the target application object includes components C1, C2, C3, C4, and C5, and components C1, C2, and C3 are set to be displayed when the responsive data A value is 1, and components C4 and C5 are set to be displayed when the responsive data A value is 2, then when the updated responsive data A value is 2, the selected target components include C4 and C5.

[0073] In step 202, during the operation, native view controls created based on the target system platform and corresponding to the target component are assigned to the target component, and the display size of the target component is determined according to the assigned native view controls.

[0074] Here, during the execution of the target program object, native view controls created based on the target system platform (natively supported by the target system platform) and corresponding to the target component are assigned to the target component, and the display size of the target component is determined based on the assigned native view controls. For example, the display size required for the assigned native view controls to be fully displayed in the user interface can be calculated and used as the display size of the target component.

[0075] It is worth noting that the same native view control can be assigned to multiple target components, such as multiple target components of the same type.

[0076] It's worth noting that some target components may not correspond to any of the native view controls. For these target components, you can obtain their default display size. For example, if a target component is used to display spaces, its default display size can be the display size occupied by the spaces.

[0077] In some embodiments, the above-mentioned allocation of native view controls created based on the target system platform and corresponding to the target component to the target component can be achieved in the following manner: query the native view control corresponding to the target component from the view reuse pool corresponding to the target program object, and allocate the queried native view control to the target component; wherein, the view reuse pool is used to store native view controls created based on the target system platform and allocated during the historical operation of the target program object.

[0078] To avoid wasting computing resources by repeatedly creating and destroying native view controls, this embodiment of the application can allocate native view controls based on a view reuse pool. For example, the native view controls corresponding to the target component are queried from the view reuse pool corresponding to the target program object, and the queried native view controls are allocated to the target component. This view reuse pool is used to store native view controls created based on the target system platform and allocated during the historical execution of the target program object. The historical execution process can refer to the last execution process or several execution processes in history. Through this method, historically allocated native view controls can be reused, thereby saving computing resources.

[0079] In some embodiments, after assigning the native view control created based on the target system platform and corresponding to the target component to the target component, the method further includes: deleting the unassigned native view control from the view reuse pool.

[0080] If, during the execution of the target program object, all target components have already been allocated native view controls, and there are still unallocated native view controls in the view reuse pool, then it proves that there is no need to continue storing the unallocated native view controls, and they can be deleted (destroyed) from the view reuse pool. This effectively saves storage resources.

[0081] In some embodiments, when there is no native view control corresponding to the target component in the view reuse pool, a native view control corresponding to the target component is created based on the target system platform, and the created native view control is assigned to the target component; wherein, the created native view control is used to store in the view reuse pool.

[0082] Here, when no native view control corresponding to the target component is found in the view reuse pool corresponding to the target application object, a native view control corresponding to the target component can be created based on the target system platform, and the created native view control can be assigned to the target component. The native view control created during the current run of the target application object can be stored in the view reuse pool for use in the next run of the target application object.

[0083] In step 203, during the operation, the interface layout is processed according to the display size of the target component to obtain the display parameters of the target component; wherein, the display parameters of the target component include the display size and the display position.

[0084] During the execution of the target program object, the interface layout can be processed according to the display size of all target components to obtain the display parameters of each target component. The display parameters of the target component include the display size and display position. There are no restrictions on the interface layout rules on which the interface layout processing depends, such as flexible layout rules (e.g., Flex layout rules).

[0085] It is worth noting that the display size in the display parameters of the target component can be the same as or different from the display size before the interface layout is processed, depending on the interface layout rules.

[0086] In step 204, during the operation, the assigned native view controls are displayed in the user interface according to the display parameters of the target component.

[0087] During the execution of the target program object, the native view controls assigned to the target component are displayed in the user interface according to the display parameters of the target component, thereby achieving reasonable display. Compared with native view controls, the amount of computation involved in calculating the target component is smaller, thus reducing the amount of computation in the data response process and achieving faster data response.

[0088] In some embodiments, the above-mentioned filtering of multiple components of the target program object based on the updated responsive data to obtain the target component can be achieved in the following manner: a virtual view tree is constructed based on the target program object; wherein the virtual view tree includes multiple branches, each branch includes multiple components, and different branches correspond to different data values ​​of the responsive data; the updated responsive data is processed to obtain the target data value; the target branch corresponding to the target data value is selected from the multiple branches, and the component in the target branch is taken as the target component.

[0089] For example, the target program object includes at least one function closure. The execution process of the target program object is essentially the execution process of the function closure within the target program object. The function closure is used to capture variables from the outer scope and use them inside the function. Here, reactive data is captured, and it can be evaluated, modified, and so on inside the function.

[0090] For each function closure within the target program object, the function closure can be logically expanded (e.g., expanding loops and conditions within the function closure) to construct a virtual view tree based on the order of the components within the function closure. This virtual view tree includes multiple branches, each containing multiple components, with different branches corresponding to different data values ​​in the reactive data. Simultaneously, the updated reactive data is processed, and for ease of differentiation, the resulting data value is named the target data value. Then, the target branch corresponding to the target data value is selected from the multiple branches of the virtual view tree, and the components within that target branch are designated as the target components.

[0091] For ease of understanding, the following are provided: Figure 4 The diagram shows a virtual view tree with branches 1 and 2. Component C0 is the root node. Branch 1 includes components C0 and C1, corresponding to the responsive data value 1; branch 2 includes components C0 and C2, corresponding to the responsive data value 2. In this case, when the target data value is 1, branch 1 is designated as the target branch, and both components C0 and C1 are designated as target components. This method improves the effectiveness and accuracy of component selection.

[0092] It is worth noting that when data is responded to in units of function closures, there can be a one-to-one relationship between the virtual view tree and the view reuse pool. That is, a view reuse pool is established for each virtual view tree, thereby supporting the display of the virtual view tree at different times.

[0093] In some embodiments, the above-mentioned assignment of native view controls created based on the target system platform and corresponding to the target component to the target component can be achieved in the following manner: perform initial recursive processing on multiple target components in the target branch, and perform the following processing during the initial recursion: assign the native view controls created based on the target system platform and corresponding to the target component recursively reached in the initial recursion to the target component recursively reached in the initial recursion.

[0094] Here, the initial recursive processing of multiple target components in the target branch of the virtual view tree is performed, that is, traversing multiple target components in the target branch according to the logic (order) within the target branch, so as to... Figure 4 For example, the initial recursive processing follows the order of "component C0-component C1". During the initial recursion, native view controls created based on the target system platform and corresponding to the target component in the initial recursion are assigned to the target component. In this way, orderly allocation can be achieved.

[0095] In some embodiments, the above-described method of displaying the assigned native view control in the user interface based on the display parameters of the target component can be achieved by recursively processing multiple target components in the target branch and performing the following processing during the recursion: displaying the native view control assigned to the recursively target component in the user interface based on the display parameters of the recursively recursed target component.

[0096] Here, multiple target components in the target branch of the virtual view tree are recursively processed again, with the order of recursion consistent with the initial recursive processing. During this recursive process, the native view controls assigned to the recursively recursively target component are displayed in the user interface based on its display parameters. This ensures that the assigned native view controls are placed systematically in the user interface, guaranteeing accurate display.

[0097] In some embodiments, the above-mentioned determination of the display size of the target component based on the assigned native view control can be achieved in the following manner: the assigned native view control is configured according to the component properties of the target component; the required display size of the assigned native view control after the property configuration is determined as the display size of the target component; the above-mentioned display of the assigned native view control in the user interface can be achieved in the following manner: the assigned native view control after the property configuration is displayed in the user interface.

[0098] Here, the assigned native view control might be an initial control without configured properties, such as a label control without any information. Therefore, the properties of the native view control assigned to the target component can be configured based on the component properties of the target component. These component properties can be pre-defined in the target application object. For example, if the target component's component property is a piece of text, and the assigned native view control is a label control without any information, then after property configuration, a label control carrying that text can be obtained.

[0099] Then, the required display size of the assigned native view control, which has undergone property configuration processing, is determined as the display size of the target component, wherein the assigned native view control, which has undergone property configuration processing, is ultimately used to display in the user interface.

[0100] It's worth noting that some target components may not correspond to any native view controls. For such target components, their final display size can be determined based on their component properties and default display size (here referring to the display size used to determine display parameters). For example, if a target component is used to display spaces, and its default display size is the size occupied by one space, and its component property is a data value of 4 (representing four spaces), then the final display size of the target component can be determined to be the size occupied by four spaces.

[0101] By using the methods described above, the accuracy of the determined display size and the accuracy of the final display can be improved.

[0102] In some embodiments, when the target component is used to invoke updated responsive data, after step 204, the method further includes: receiving a trigger operation for the assigned native view control through the user interface; and treating the trigger operation as an update operation for the updated responsive data.

[0103] Here, the target component can be used to call updated responsive data, for example, the updated responsive data can be used as input parameters for the target component. In this case, a two-way synchronization relationship is formed between the target component and the updated responsive data, that is, the target component can rely on the updated responsive data for display, and at the same time, the target component can also be used to update the updated responsive data again.

[0104] For example, after the assigned native view control is displayed in the user interface, trigger operations for the assigned native view control can be received through the user interface, and these trigger operations can be used as update operations for the updated responsive data. This approach improves the flexibility of data response and broadens application scenarios.

[0105] like Figure 3B As shown, this application embodiment can improve the accuracy and rationality of the display and enhance the user experience by allocating native view controls and calculating display parameters; at the same time, performing relevant calculations on the target component can save more computational load and reduce the consumption of computing resources compared to performing relevant calculations on the native view controls.

[0106] In some embodiments, see Figure 3C , Figure 3C This is a flowchart illustrating a data response method in a system platform provided in this application embodiment, which can be executed by an electronic device. Figure 3C middle, Figure 3A Before step 102 shown ( Figure 3C (Taking step 101 as an example), in step 301, a subscription relationship can also be established between each program object and at least one responsive data.

[0107] In this embodiment, a subscription relationship can be pre-established between each program object and at least one reactive data. For a program object, all subscribed reactive data can be recorded internally; similarly, for reactive data, all program objects subscribed to that reactive data can be recorded internally.

[0108] In some embodiments, the above-described establishment of a subscription relationship between each program object and at least one reactive data can be achieved in the following manner: For any program object, perform any of the following processes: In response to a subscription configuration operation for any program object, establish a subscription relationship between the program object and the reactive data configured by the subscription configuration operation; When the initialization condition is met, run the program object, determine the reactive data invoked during the execution of the program object, and establish a subscription relationship between the program object and the invoked reactive data; wherein the initialization condition includes any of the following: any program object is created; enter the next message loop after the program object is created.

[0109] For each program object created, the following two methods are provided to establish a subscription relationship, which will be explained separately.

[0110] 1) In response to a subscription configuration operation on a program object, a subscription relationship is established between the program object and the reactive data configured by the subscription configuration operation. For example, relevant personnel can manually configure the subscription relationship by implementing the subscription configuration operation. This method can configure the subscription relationship without running the program object, thus reducing the consumption of computing resources.

[0111] 2) When the initialization conditions are met, the program object is run, the reactive data invoked during the program object's execution is determined, and a subscription relationship is established between the program object and the invoked reactive data. This method automatically establishes the subscription relationship by initializing the created program object, ensuring the accuracy of the established subscription relationship while reducing manual costs. The initialization conditions can include any of the following: the program object is created (i.e., the program object is run immediately upon creation); or the next message loop after the program object is created is entered. The specific initialization conditions can be selected based on the urgency of establishing the subscription relationship.

[0112] Either of the two methods can be used, which can improve the flexibility of establishing subscription relationships.

[0113] In some embodiments, when the reactive data is template-type data, the above-mentioned establishment of a subscription relationship between each program object and at least one reactive data can be achieved by establishing a subscription relationship between each program object and a non-template parent class of at least one reactive data; wherein, the non-template parent class is used to notify the corresponding program object to run according to the established subscription relationship when at least one reactive data is updated.

[0114] When reactive data is template-based, the code size increases significantly after template instantiation. Therefore, to reduce the compiled code size, reactive capabilities can be placed in the non-template parent class of the reactive data. For example, a subscription relationship can be established between each program object and at least one non-template parent class of reactive data. Reactive capabilities include, but are not limited to, recording subscription relationships and notifying the corresponding program object to run based on the subscription relationship when the reactive data is updated.

[0115] like Figure 3C As shown, during the execution of the target program object, the subscription relationship between the target program object and the updated responsive data can be re-established in step 302.

[0116] Here, during the execution of the target program object, the subscription relationship between the target program object and the updated reactive data can be re-established, thus updating the subscription relationship. This ensures the validity and accuracy of the subscription relationship.

[0117] like Figure 3C As shown, this application embodiment can achieve accurate data response by pre-establishing a subscription relationship and updating the subscription relationship during the operation of the target program object.

[0118] The following will describe exemplary applications of the embodiments of this application in real-world application scenarios. The embodiments of this application provide a lightweight, native cross-platform client (i.e., application) development framework. It uses C++, a language natively supported by various system platforms (such as iOS, Android, Windows, and macOS), as the development language. It does not change the underlying mechanisms of the system platform, has good compatibility, and can cover most of the underlying logic and interface development. The code in the development framework provided by the embodiments of this application (corresponding to the program objects mentioned above) can be shared and used across various system platforms, while retaining the flexibility of native development, allowing each system platform to perform arbitrary customization based on this development framework.

[0119] For ease of understanding, the following are provided: Figure 5 The diagram shown illustrates the client-side development framework. Figure 5The modules represented by solid lines are shared across all system platforms, while those represented by dashed lines are specific to each system platform and will be explained separately.

[0120] 1) Shared code section. See [link / reference] Figure 5 The shared code includes four modules: data-driven development, interface layout, interface controls, and interface operations. The data-driven development module has no dependencies on the other modules, can work independently, and allows for reactive application logic, greatly simplifying application state maintenance and interface updates.

[0121] The interface layout module supports the calculation of display parameters (such as display size and display position) of the interface controls (corresponding to the components above) contained in the layout component in a flexible layout manner, and constructs the final native view tree for display. The native view tree includes several native view controls that need to be displayed.

[0122] The UI control module uses a set of system platform-independent interfaces to describe the commonly used UI controls required for application development, and leverages data-driven capabilities to complete data binding and updates. Figure 5 The example shows interface controls such as Page, Label, Button, and TextField. More interface controls can be defined according to the needs of actual application scenarios. The interface controls correspond to the components mentioned above.

[0123] The interface operation module provides a set of system platform-independent interfaces, supporting mixed navigation (or switching) between multiple functional modules developed within this development framework and natively developed modules. Figure 5 The example illustrates several interface switching operations, including context operations, push, pop, present, and dismiss.

[0124] 2) System platform related parts. See [link / reference] Figure 5The system platform-related components include two modules: platform infrastructure and platform native view bridging. The platform infrastructure module is responsible for bridging the differences between various system platforms, providing a unified support environment for shared code, allowing shared code to be developed in a platform-independent manner. Bridging the differences between system platforms mainly focuses on message loops and event mechanisms. Both message loops and event mechanisms are provided by each system platform itself. This embodiment encapsulates the relevant calling methods to achieve adaptation to different system platforms. Taking the message loop as an example, Windows uses `while GetMessage()`, Android uses `Looper()`, and iOS / macOS uses `NSRunLoop()`. This embodiment encapsulates the message delivery methods of each system platform into a unified `nextTick()` method. Calling this method adds tasks to the message loop of each system platform, such as tasks that deliver update operations. Here, `whileGetMessage()`, `Looper()`, and `NSRunLoop()` correspond to the message program objects mentioned above, and `nextTick()` corresponds to the encapsulated message program object mentioned above.

[0125] The platform native view bridging module is responsible for the specific implementation of the interface control module in various system platforms. For example, it can be used to manage the native view controls of various system platforms and leverage data-driven capabilities to keep the information in the native view controls synchronized with the underlying data. Figure 5 As shown, the platform's native view bridging module can be implemented using front-end frameworks such as UIKit, Cocoa, AppKit, Android View, and Duilib, but it is not limited to these.

[0126] Next, the client development framework provided in the embodiments of this application will be further explained.

[0127] 1) Data-driven development.

[0128] Data-driven development primarily involves responsive data. When responsive data changes, a series of related operations can be triggered according to the rules set by the development framework. For example, it can trigger the execution of all program objects that are interested in the responsive data. The development framework can automatically maintain which program objects are interested in the responsive data.

[0129] The type of read-only reactive data can be defined as Reactive. <t>Its internal data structure records a vector of all subscribers with whom it has a subscription relationship. <Watcher The subscriber is the program object mentioned above. The type of readable and writable reactive data is defined as Value. <t>It can be implicitly converted to Reactive. <t>In this context, implicit conversion refers to the compiler automatically generating conversion code, eliminating the need for developers to explicitly write it. Read-only reactive data can be created using `readonly(1)`, for example, "Reactive...". <int>"anInt=readonly(1)" means creating a read-only reactive data object named anInt; read-write reactive data can be created using reactive(true), for example, "Value <bool>"aBool=reactive(true)" means to create a readable and writable reactive data named aBool. Of course, the above is just an example, and the creation method is not limited to this.

[0130] A subscriber, referred to as a Watcher, requires a function closure as a parameter during creation. This function closure contains code that processes reactive data (e.g., evaluates and modifies it). The function closure is an anonymous function that can capture variables from the outer scope and use them within the function; here, reactive data is captured, and its evaluation and modification can be performed inside the function.

[0131] like Figure 6 As shown in the embodiments of this application, the framework, when initializing a subscriber, executes a function closure within the subscriber, determines the reactive data captured by the function closure, and creates a subscription relationship between the subscriber and the reactive data. The management of the subscription relationship corresponds to... Figure 5 Dependency management is illustrated. The established subscription relationship includes two aspects, such as... Figure 6 As shown, the first aspect is to store a list of all subscribers of the reactive data in the reactive data memory, which corresponds to the vector mentioned above. <Watcher The second aspect is storing a list of all subscribed reactive data in the subscriber's memory. It's worth noting that subscribers can be initialized when they are created, or in the next message loop after creation. Alternatively, initialization can be omitted, and the initial subscription relationship can be specified directly, such as manually.

[0132] For a subscriber like Watcher, it can record and hold all its subscriptions in shared_ptr format. <dep>Here, Dep represents the non-template parent class of reactive data. The reason for this is that reactive data is a template class, and the code size will increase significantly after template instantiation. Therefore, in order to reduce the size of the compiled code, the reactive capabilities are placed in the non-template parent class. Reactive capabilities include recording subscription relationships and notifying subscribers to execute function closures.

[0133] In this application embodiment, there are also some subscribers with special identities. For example, subscribers created using function closures that have no return value (a return value can be represented by `return`) are also called side-effect functions. For instance, the function closure in a side-effect function outputs reactive data to the user interface for display using `std::cout`.

[0134] For example, computational data has a dual identity: it is both subscriber and reactive data, and can be implicitly converted into reactive data. <t>Use it. The function closure within the computed data will return a value (for example, the return value is the result of multiplying the reactive data by 2) as the result of the computed data, and the computed data can be subscribed to by other subscribers.

[0135] The following example illustrates data-driven (data-responsive) approaches. When reactive data changes (i.e., the reactive data is updated), the development framework lists all current subscribers of that reactive data and records them in the execution list (corresponding to the list to be run above). Then, before the next message loop begins, the subscribers in the execution list are sorted according to their creation order, and the function closures within each subscriber are executed sequentially. This sorting can be done in ascending order of creation time. Simultaneously, the subscription relationship between the subscriber and the corresponding reactive data is updated (i.e., the subscription relationship is re-established), ensuring the accuracy and real-time nature of the subscription relationship and better realizing data-driven capabilities.

[0136] For ease of understanding, the embodiments of this application provide, as follows: Figure 7 The data-driven (data response) process shown is in Figure 7 In the context of reactive data A, subscribers X and Y, and subscribers Y and Z, reactive data B's data value is updated from 1 to 2. Therefore, subscribers X and Y are added to the execution list. Similarly, since the data value of reactive data B is updated from 3 to 4, subscribers Y and Z are added to the execution list. Because subscriber Y subscribes to both reactive data A and B, adding subscriber Y to the execution list only needs to be done once. Then, before the next message loop begins, the function closures of each subscriber in the execution list are executed sequentially.

[0137] It's worth noting that if a responsive data entry has no subscribers, it can be deleted to save space.

[0138] 2) The process of constructing the view tree and the layout of the interface.

[0139] This application embodiment uses a virtual view tree (also known as a virtual view node tree) to represent the view structure. Before actual display, the virtual view tree is first flattened to obtain the virtual view tree that actually needs to participate in the interface layout. Then, the actual native view tree is constructed based on the virtual view tree. Various display parameters are recursively calculated according to the set layout rules (such as flexible layout rules) to complete the interface layout and display it on the screen, i.e., in the user interface. This application embodiment provides, as follows: Figure 8 The diagram illustrating the interface layout and display process is presented below. For ease of understanding, the following pseudocode (which exists within a function closure in the subscriber; in practice, the actual code can be written in C++) will be used as an example: Define a readable and writable reactive data type `newbie` and initialize its value to `true`.

[0140] Based on the pseudocode above, the layout components and UI controls provided by the development framework can be used to display corresponding content in the user interface with the native visual style and interactive effects of the system platform. The layout components are only responsible for the layout calculations of the components defined by the development framework and are not associated with native view controls, meaning they are independent of the system platform. However, the UI controls (i.e., the components defined by the development framework) are always associated with native view controls and require bridging between different system platforms.

[0141] For example, after the pseudocode above is executed, it will construct a virtual view tree in memory to represent the corresponding interface hierarchy. In the actual process of displaying this virtual view tree, steps a) to d) can be executed.

[0142] a) Flatten the view tree.

[0143] Expanding the loops (such as For loops) and conditions (such as If…Then…Else) in the pseudocode yields multiple branches of a virtual view tree, each branch containing multiple components. The reactive data `newbie` is evaluated, and the corresponding branch's component is selected based on the evaluated value. Here, `newbie`'s value is `true`, therefore, the Label component of the Else branch (i.e., the branch "otherwise, perform the following processing") is discarded. Thus, the child components of the Row component (also known as the root component) include the Label component of the Then branch (i.e., the branch "when `newbie`'s value is `true`, perform the following processing"), as well as subsequent Space, Label, and CheckBox components.

[0144] It is worth noting that, Figure 8 The slots shown in the slot-filling diagram are placeholders, used to give developers the ability to customize the internal content of components.

[0145] b) Enter the view reuse pool.

[0146] Here, the view reuse pool records the native view controls that the virtual view tree has already used before this interface layout. To avoid resource waste caused by repeatedly creating and destroying native view controls, the native view controls in the view reuse pool can be reused. It is worth noting that if the above pseudocode is executed for the first time, that is, the first time the interface layout is performed, the view reuse pool will be empty. In addition, there can be a one-to-one correspondence between the virtual view tree and the view reuse pool.

[0147] c) Perform interface layout.

[0148] The recursion starts from the root component Row. Row does not need to allocate native view controls. The display parameters of Row are determined by its child components. Therefore, the loop is started to lay out the interface of all child components of Row.

[0149] The loop begins with the Label component, which is allocated a native view control from the view reuse pool. This implementation can rely on the platform's native view bridging module for selection, such as (iOS: UILabel; Android: TextView; Windows: CLabelUI; macOS: NSTextField). Specifically, the native view control corresponding to the Label component in the iOS system platform is UILabel, and so on.

[0150] After assigning the native view controls, the properties of the assigned native view controls are configured according to the component properties of the Label component. These configured properties include, but are not limited to, text, font, font size, text color, number of lines, and text truncation method. Since the pseudocode above sets Label("Hello"), the properties of the assigned native view controls are configured based on the text "Hello". This implementation can also rely on the platform's native view bridging module for selection, such as (iOS: setText; Android: setText; Windows: SetText, macOS: setStringValue).

[0151] After configuring the properties of the assigned native view control, the required display size for the native view control to be fully displayed is calculated and recorded. The method for calculating the display size may differ across different system platforms, for example (iOS, macOS: sizeThatFits; Android: measure; Windows: EstimateSize).

[0152] For the second child component in the loop, namely the Space component, there is no need to allocate a native view control. The Space component occupies a fixed size given by the parameter (as set by parameter 4 in the pseudocode above).

[0153] The processing logic for the third child component in the loop, namely the Label component, is the same as that for the first Label component, and will not be described in detail here.

[0154] For the fourth child component in the loop, the CheckBox component, it allows passing the reactive data `newbie`, indicating that the state of this CheckBox component will be bidirectionally synchronized with this read-write reactive data `newbie`. Since the current data value of `newbie` is true, the checkbox is checked. The native view control corresponding to this CheckBox component can be selected using the platform's native view bridging module, which will not be detailed here.

[0155] After the loop is complete, the Row component calculates the display parameters (including display size and display position) of each child component according to the display size of the four inner components and the rules of flexible layout, and also calculates the display parameters of the Row component itself.

[0156] After the layout calculation of the Row component is completed, recursion is executed again to place the native view controls assigned to each component in the corresponding places in the user interface based on the previously recorded display size.

[0157] d) Leave the view reuse pool.

[0158] Unused native view controls in the view reuse pool that are not used during the current interface layout are recycled, i.e., removed from the view reuse pool. This prevents useless native view controls from occupying space in the view reuse pool.

[0159] It's worth noting that the pseudocode above can reside within a function closure of a side-effect function. Since the view tree flattening operation is performed within the function closure, evaluating `newbie`, this side-effect function automatically establishes a subscription relationship with the reactive data `newbie`. In this case, if the user triggers (here, a click as an example) the checkbox control displayed in the user interface (i.e., the native view control corresponding to the CheckBox component), because the CheckBox component and `newbie` have established a two-way synchronization relationship, the operation will cause the data value of `newbie` to change, thereby triggering the function closure of the side-effect function to be re-executed in the next message loop, completing the reactive update of the virtual view tree and achieving effective data-driven processing.

[0160] For ease of understanding, the embodiments of this application provide, as follows: Figure 9A , Figure 9B , Figure 9C and Figure 9D The diagram illustrates the user interface, displaying the text "Hello World" and a checked checkbox. If the user deselects the checkbox by clicking it, the text changes to "Goodbye World," thus achieving a responsive update. Figure 9A For the iOS system platform, Figure 9B For the Android system platform, Figure 9C For macOS system platform, Figure 9D For the Windows system platform, based on the user interface shown, it can be determined that by using the development framework provided in this application embodiment, only a few lines of code are needed to run on major mainstream system platforms, producing an interactive user interface (UI) that adapts to the native style of each system platform, greatly improving development efficiency.

[0161] In summary, the embodiments of this application have at least the following technical effects: 1) It provides a native cross-system platform client development framework, which allows for the construction of native user interfaces adapted to multiple system platforms by writing code once in C++, which can significantly improve development efficiency, save human resources, and optimize project costs; 2) The solution itself is extremely lightweight, with the source code being only 400 kilobytes (KB) in some cases, without additional third-party dependencies, and no modifications to existing projects are required when integrating it; 3) Since it is developed using a programming language natively supported by the system platform, the application's running performance can be improved after the developed application is deployed to the system platform; 4) Applications developed using the development framework do not require cross-language communication, which can avoid the occurrence of glue code.

[0162] The following continues to describe an exemplary structure in which the data response device 455 in the system platform provided in this application is implemented as a software module. In some embodiments, such as Figure 2 As shown, the software modules in the data response device 455 stored in the system platform of memory 450 may include: an update module 4551, used to update the responsive data in response to an update operation for the responsive data; a filtering module 4552, used to filter target program objects that have a subscription relationship with the updated responsive data from multiple program objects; wherein each program object supports running on multiple system platforms; and a response module 4553, used to run the target program object, and during the running process, to allocate and process the native view controls of the target system platform according to the updated responsive data, and to display the allocated native view controls in the user interface.

[0163] In some embodiments, the response module 4553 is further configured to: perform the following processing during the operation of the target program object: filter multiple components included in the target program object according to the updated responsive data to obtain a target component; assign a native view control created based on the target system platform and corresponding to the target component to the target component, and determine the display size of the target component according to the assigned native view control; perform interface layout processing according to the display size of the target component to obtain the display parameters of the target component; wherein, the display parameters of the target component include the display size and the display position; and display the assigned native view control in the user interface according to the display parameters of the target component.

[0164] In some embodiments, the response module 4553 is further configured to: query the native view control corresponding to the target component from the view reuse pool corresponding to the target program object, and assign the queried native view control to the target component; wherein, the view reuse pool is used to store native view controls created based on the target system platform and assigned during the historical operation of the target program object; and delete the unassigned native view controls in the view reuse pool.

[0165] In some embodiments, the response module 4553 is further configured to: when there is no native view control corresponding to the target component in the view reuse pool, create a native view control corresponding to the target component based on the target system platform, and assign the created native view control to the target component; wherein the created native view control is used to store in the view reuse pool.

[0166] In some embodiments, the response module 4553 is further configured to: construct a virtual view tree based on the target program object; wherein the virtual view tree includes multiple branches, each branch includes multiple components, and different branches correspond to different data values ​​of the responsive data; perform value processing on the updated responsive data to obtain the target data value; filter out the target branch corresponding to the target data value from the multiple branches, and use the components in the target branch as the target components.

[0167] In some embodiments, the response module 4553 is further configured to perform initial recursive processing on multiple target components in the target branch, and to perform the following processing during the initial recursion: assigning a native view control created based on the target system platform and corresponding to the target component to which the initial recursion is performed to the target component to which the initial recursion is performed.

[0168] In some embodiments, the response module 4553 is further configured to recursively process multiple target components in the target branch, and perform the following processing during the recursion: display the native view control assigned to the recursively target component in the user interface according to the display parameters of the recursively recursed target component.

[0169] In some embodiments, the response module 4553 is further configured to: perform attribute configuration processing on the allocated native view control according to the component attributes of the target component; determine the display size required for the allocated native view control after attribute configuration processing when it is displayed, so as to serve as the display size of the target component; and display the allocated native view control after attribute configuration processing in the user interface.

[0170] In some embodiments, when the target component is used to invoke updated responsive data, the response module 4553 is further configured to: receive a trigger operation for the assigned native view control through the user interface; and treat the trigger operation as an update operation for the updated responsive data.

[0171] In some embodiments, the data response device 455 in the system platform further includes an establishment module for: establishing a subscription relationship between each program object and at least one responsive data; the response module 4553 is also used for: re-establishing the subscription relationship between the target program object and the updated responsive data.

[0172] In some embodiments, the establishment module is further configured to perform any of the following processes for any program object: in response to a subscription configuration operation for any program object, establish a subscription relationship between the program object and the reactive data configured by the subscription configuration operation; when the initialization condition is met, run the program object, determine the reactive data called during the execution of the program object, and establish a subscription relationship between the program object and the called reactive data; wherein the initialization condition includes any of the following: the program object is created; or the next message loop after the program object is created.

[0173] In some embodiments, when the reactive data is template-type data, the establishment module is further configured to: establish a subscription relationship between each program object and at least one non-template parent class of the reactive data; wherein the non-template parent class is configured to notify the corresponding program object to run according to the established subscription relationship when at least one reactive data is updated.

[0174] In some embodiments, the response module 4553 is further configured to: add the target program object to the list to be run; and run the multiple target program objects sequentially according to the creation order of the multiple target program objects in the list to be run.

[0175] In some embodiments, the response module 4553 is further configured to: perform function operations on the updated response data to obtain a return data value; wherein the return data value is used to be invoked by a program object that has a subscription relationship with the target program object.

[0176] In some embodiments, the data response device 455 in the system platform further includes a message loop module, configured to: run an encapsulated message program object among multiple program objects to trigger a message loop in the target system platform; wherein the encapsulated message program object is obtained by encapsulating message program objects corresponding to multiple system platforms respectively; wherein the message loop is used to perform message transmission with the target system platform, and the messages transmitted by the message loop include update operations.

[0177] In some embodiments, the assigned native view control corresponds to the native function of the target system platform; the response module 4553 is further configured to: in response to a trigger operation on the assigned native view control, run a function jump program object among multiple program objects to display the execution process of the native function in the user interface.

[0178] This application provides a computer program product or computer program that includes computer instructions (i.e., executable instructions) stored in a computer-readable storage medium. An electronic device's processor reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the data response method in the system platform described in this application embodiment.

[0179] This application provides a computer-readable storage medium storing executable instructions, wherein the executable instructions, when executed by a processor, will cause the processor to execute the data response method in the system platform provided in this application.

[0180] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.

[0181] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0182] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).

[0183] As an example, executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located in one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.

[0184] The above are merely embodiments of this application and are not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.< / t> < / dep> < / bool> < / int> < / t> < / t> < / t>

Claims

1. A data response method in a system platform, characterized in that, The method is applied to a target system platform, which can be any one of multiple system platforms; the method includes: In response to an update operation on the responsive data, the responsive data is updated. Select target program objects from multiple program objects that have a subscription relationship with the updated responsive data; wherein each program object supports running on the multiple system platforms; The target program object is run, and the following processes are performed during the execution of the target program object: A virtual view tree is constructed based on the target program object; wherein the virtual view tree includes multiple branches, each branch includes multiple components, and different branches correspond to different data values ​​of the responsive data; The updated responsive data is processed to obtain the target data value; Filter out the target branch that corresponds to the target data value from the multiple branches, and take the component in the target branch as the target component; The native view control created based on the target system platform and corresponding to the target component is assigned to the target component, and the display size of the target component is determined according to the assigned native view control; The interface layout is processed according to the display size of the target component to obtain the display parameters of the target component; wherein, the display parameters of the target component include the display size and the display position; Based on the display parameters of the target component, the assigned native view control is displayed in the user interface.

2. The method according to claim 1, characterized in that, Assigning the native view control created based on the target system platform and corresponding to the target component to the target component includes: Query the native view control corresponding to the target component from the view reuse pool corresponding to the target program object, and assign the queried native view control to the target component; The view reuse pool is used to store native view controls created based on the target system platform and allocated during the historical execution of the target program object; After assigning the native view control created based on the target system platform and corresponding to the target component to the target component, the method further includes: Delete any unassigned native view controls from the view reuse pool.

3. The method according to claim 1, characterized in that, Assigning the native view control created based on the target system platform and corresponding to the target component to the target component includes: The initial recursive processing is performed on multiple target components in the target branch, and the following processing is performed during the initial recursion: Assign the native view control created based on the target system platform and corresponding to the target component that was initially recursively assigned to it to the target component that was initially recursively assigned to it. The step of displaying the assigned native view control in the user interface according to the display parameters of the target component includes: The target components in the target branch are recursively processed again, and the following processing is performed during the recursive process: Based on the display parameters of the target component that is recursively returned, the native view control assigned to the target component is displayed in the user interface.

4. The method according to claim 1, characterized in that, Determining the display size of the target component based on the assigned native view control includes: Based on the component attributes of the target component, the allocated native view control is configured with attributes. Determine the required display size of the assigned native view control after the attribute configuration process, and use it as the display size of the target component; The process of displaying the assigned native view control in the user interface includes: The assigned native view control, processed by the attribute configuration, is displayed in the user interface.

5. The method according to claim 1, characterized in that, When the target component is used to invoke the updated responsive data, after displaying the assigned native view control in the user interface, the method further includes: The user interface receives trigger operations for the assigned native view controls. The triggering operation is treated as an update operation for the updated responsive data.

6. The method according to any one of claims 1 to 5, characterized in that, Before filtering out the target program objects that have a subscription relationship with the updated responsive data from multiple program objects, the method further includes: Establish a subscription relationship between each of the program objects and at least one reactive data; When assigning a native view control created based on the target system platform and corresponding to the target component to the target component, the method further includes: Re-establish the subscription relationship between the target program object and the updated responsive data.

7. The method according to claim 6, characterized in that, Establishing a subscription relationship between each of the program objects and at least one reactive data includes: For any given program object, perform any of the following processing steps: In response to a subscription configuration operation for any one of the program objects, a subscription relationship is established between the any one of the program objects and the reactive data configured by the subscription configuration operation; When the initialization conditions are met, run any one of the program objects, determine the reactive data called during the execution of any one of the program objects, and establish a subscription relationship between any one of the program objects and the called reactive data. The initialization conditions include any one of the following: any one of the program objects is created; entering the next message loop after any one of the program objects is created.

8. The method according to claim 6, characterized in that, When the responsive data is template-type data, establishing a subscription relationship between each program object and at least one responsive data includes: Establish a subscription relationship between each of the program objects and at least one non-template parent class of reactive data; The non-template parent class is used to notify the corresponding program object to run according to the established subscription relationship when the at least one reactive data is updated.

9. The method according to any one of claims 1 to 5, characterized in that, After filtering out the target program objects from multiple program objects that have a subscription relationship with the updated responsive data, the method further includes: Add the target program object to the list of programs to be run; When there are multiple target program objects, running the target program objects includes: The multiple target program objects are run sequentially according to the creation order of the multiple target program objects in the list to be run.

10. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Run the message encapsulation program object among the multiple program objects to trigger the message loop in the target system platform; The encapsulated message program object is obtained by encapsulating the message program objects corresponding to the various system platforms respectively. The message loop is used to transmit messages with the target system platform, and the messages transmitted by the message loop include the update operation.

11. A data response device in a system platform, characterized in that, Applied to a target system platform, wherein the target system platform is any one of multiple system platforms; the device includes: An update module is used to update the responsive data in response to an update operation on the responsive data. A filtering module is used to filter out target program objects that have a subscription relationship with the updated responsive data from multiple program objects; wherein each program object supports running on the multiple system platforms; The response module is used to run the target program object and perform the following processing during the execution of the target program object: A virtual view tree is constructed based on the target program object; wherein the virtual view tree includes multiple branches, each branch includes multiple components, and different branches correspond to different data values ​​of the responsive data; The updated responsive data is processed to obtain the target data value; Filter out the target branch that corresponds to the target data value from the multiple branches, and take the component in the target branch as the target component; The native view control created based on the target system platform and corresponding to the target component is assigned to the target component, and the display size of the target component is determined according to the assigned native view control; The interface layout is processed according to the display size of the target component to obtain the display parameters of the target component; wherein, the display parameters of the target component include the display size and the display position; Based on the display parameters of the target component, the assigned native view control is displayed in the user interface.

12. The apparatus according to claim 11, characterized in that, The response module is also configured to query the native view control corresponding to the target component from the view reuse pool corresponding to the target program object, and assign the queried native view control to the target component; The view reuse pool is used to store native view controls created based on the target system platform and allocated during the historical execution of the target program object; Delete any unassigned native view controls from the view reuse pool.

13. The apparatus according to claim 11, characterized in that, The response module is also used to perform initial recursive processing on multiple target components in the target branch, and to perform the following processing during the initial recursion: Assign the native view control created based on the target system platform and corresponding to the target component that was initially recursively assigned to it to the target component that was initially recursively assigned to it. The target components in the target branch are recursively processed again, and the following processing is performed during the recursive process: Based on the display parameters of the target component that is recursively returned, the native view control assigned to the target component is displayed in the user interface.

14. The apparatus according to claim 11, characterized in that, The response module is also used to perform attribute configuration processing on the allocated native view control according to the component attributes of the target component; Determine the required display size of the assigned native view control after the attribute configuration process, and use it as the display size of the target component; The assigned native view control, processed by the attribute configuration, is displayed in the user interface.

15. The apparatus according to claim 11, characterized in that, When the target component is used to call the updated responsive data, the response module is also used to receive a trigger operation for the assigned native view control through the user interface after the assigned native view control is displayed in the user interface; The triggering operation is treated as an update operation for the updated responsive data.

16. The apparatus according to any one of claims 11 to 15, characterized in that, The device further includes: A module is established to establish a subscription relationship between each program object and at least one piece of responsive data before filtering out target program objects that have a subscription relationship with the updated responsive data from multiple program objects; When a native view control created based on the target system platform and corresponding to the target component is assigned to the target component, the response module is also used to re-establish the subscription relationship between the target program object and the updated responsive data.

17. The apparatus according to claim 16, characterized in that, The creation module is also used to perform any of the following processes for any program object: In response to a subscription configuration operation for any one of the program objects, a subscription relationship is established between the any one of the program objects and the reactive data configured by the subscription configuration operation; When the initialization conditions are met, run any one of the program objects, determine the reactive data called during the execution of any one of the program objects, and establish a subscription relationship between any one of the program objects and the called reactive data. The initialization condition includes any one of the following: any one of the program objects is created; Enter the next message loop after any of the program objects is created.

18. The apparatus according to claim 16, characterized in that, When the responsive data is template-type data, the establishment module is also used to establish a subscription relationship between each program object and at least one non-template parent class of the responsive data; The non-template parent class is used to notify the corresponding program object to run according to the established subscription relationship when the at least one reactive data is updated.

19. The apparatus according to any one of claims 11 to 15, characterized in that, The response module is further configured to add the target program object to the list to be run after filtering out the target program object that has a subscription relationship with the updated responsive data from multiple program objects; When there are multiple target program objects, the response module is further configured to run multiple target program objects sequentially according to the creation order of the multiple target program objects in the list to be run.

20. The apparatus according to any one of claims 11 to 15, characterized in that, The response module is also used to run the encapsulated message program object among the plurality of program objects to trigger the message loop in the target system platform; The encapsulated message program object is obtained by encapsulating the message program objects corresponding to the various system platforms respectively. The message loop is used to transmit messages with the target system platform, and the messages transmitted by the message loop include the update operation.

21. An electronic device, characterized in that, include: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the data response method in the system platform according to any one of claims 1 to 10.

22. A computer-readable storage medium, characterized in that, It stores executable instructions for implementing the data response method in the system platform according to any one of claims 1 to 10 when executed by a processor.

23. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the data response method in the system platform according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Page display method, page display device and storage medium

    CN107220371A