Event processing method and apparatus, electronic device, and storage medium
By generating object proxies in the local service layer and listening to operation events, the problem of automatic synchronization between memory data and the displayed page is solved, achieving efficient decoupling and responsiveness between memory data and the displayed page, reducing memory usage, and improving response efficiency.
Patent Information
- Application Number
- CN202311172595.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-12
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2043-09-12
AI Technical Summary
In existing technologies, two-way binding is inefficient and cannot effectively solve the problem of automatic synchronization between memory usage data and displayed pages, and it also suffers from excessive memory consumption.
By generating proxies for objects in the local service layer and listening to object operation events in the local service layer, cross-layer listening is reduced. By using pointers to point to document object nodes, memory usage is reduced and response efficiency is improved.
It achieves automatic synchronization between memory data and the display page, decoupling the memory data end and the display page end, reducing the memory usage of the application framework layer, and improving the efficiency of responding to operation events.
Smart Images

Figure CN119621252B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of event processing technology, and in particular to an event processing method and apparatus, electronic device, and storage medium. Background Technology
[0002] Two-way data binding is a key technology that enables automatic synchronization between in-memory data and the displayed page, making application development more convenient and efficient. Two-way binding can be understood as the data displayed on the page in the view and a specific memory location allocated by the browser to store that data. Binding can be understood as the ability to mutually modify each other, ultimately achieving consistency. For example, modifications to data in the in-memory data location are reflected in the view after page rendering; conversely, when we actively change values on the page, corresponding changes occur in the in-memory data location. However, improving the efficiency of two-way binding and reducing memory consumption still warrants attention. Summary of the Invention
[0003] This disclosure provides an event handling method and apparatus, an electronic device, and a storage medium.
[0004] According to a first aspect of the present disclosure, an event handling method is provided, comprising:
[0005] In response to detecting an access instruction to an object on the page or the memory of the object, a proxy for the object is generated in the local service layer; wherein the memory of the object is located in the local service layer;
[0006] Based on the object's proxy, listen for operation events on the object in the local service layer;
[0007] Respond to operation events on the object in the memory of the page and the object.
[0008] In some embodiments, listening for operation events on the object at the local service layer according to the object's proxy includes:
[0009] The object's proxy invokes predefined functions in the local service layer to listen for operation events on the object.
[0010] In some embodiments, the step of invoking a predefined function in the local service layer through the proxy of the object and listening for operation events on the object includes:
[0011] The object's proxy invokes a predefined function in the local service layer in the form of a callback function to listen for operation events on the object.
[0012] In some embodiments, listening for operation events on the object at the local service layer according to the object's proxy includes:
[0013] The proxy of the object is pointed to as a pointer to the document object node corresponding to the object in the local service layer, and operation events on the object are listened for.
[0014] In some embodiments, in response to the operation event being an event that updates the object, the method further includes:
[0015] The pointer is released after the memory of the page and the object responds to an update of the object.
[0016] In some embodiments, responding to operation events on the object in the memory of the page and the object includes:
[0017] The local service layer updates the memory of the object based on the operation event; and,
[0018] In the local service layer, the memory of the object is bound to the document object node that uses the memory of the object, and the bound document object node is updated according to the operation event;
[0019] The updated document object node is rendered in the local service layer, and the rendered page is displayed.
[0020] In some embodiments, the page is a quick app page.
[0021] According to a second aspect of the present disclosure, an event processing apparatus is provided, comprising:
[0022] A generation module is configured to generate a proxy for an object in a local service layer in response to a detected access instruction to an object in a page or the memory of the object; wherein the memory of the object is located in the local service layer;
[0023] The listening module is configured to listen for operation events on the object in the local service layer based on the object's proxy.
[0024] A response module is configured to respond to operation events on the object in the memory of the page and the object.
[0025] In some embodiments, the listening module is further configured to call a predefined function in the local service layer through the proxy of the object to listen for operation events on the object.
[0026] In some embodiments, the listening module is further configured to call a predefined function in the local service layer in the form of a callback function through the object's proxy to listen for operation events on the object.
[0027] In some embodiments, the listening module is further configured to point the proxy of the object to the document object node corresponding to the object in the local service layer in the form of a pointer, and to listen for operation events on the object.
[0028] In some embodiments, in response to the operation event being an event that updates the object, the apparatus further includes:
[0029] The release module is configured to release the pointer after the memory of the page and the object responds to an update of the object.
[0030] In some embodiments, the response module is further configured to update the memory of the object in the local service layer according to the operation event; and, in the local service layer, bind the memory of the object to a document object node that uses the memory of the object, and update the bound document object node according to the operation event; render the updated document object node in the local service layer, and display the rendered page.
[0031] In some embodiments, the page is a quick app page.
[0032] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0033] A processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the method as described in the first aspect above.
[0034] According to a fourth aspect of the present disclosure, a storage medium is provided, comprising:
[0035] When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the method described in the first aspect above.
[0036] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:
[0037] In this embodiment, two-way binding via object proxies enables automatic synchronization between memory data and the displayed page, decoupling the memory data side and the displayed page side. Furthermore, since this embodiment generates object proxies at the local service layer and listens for object operation events there, without requiring cross-layer listening, compared to generating object proxies at the application framework layer based on complex data structures and frequent interactions between the application framework layer and the local service layer for listening, this reduces memory usage at the application framework layer and improves the efficiency of both the page and memory sides in responding to operation events.
[0038] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0039] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0040] Figure 1 This is a schematic diagram of a responsive data model in related technologies.
[0041] Figure 2 This is a diagram illustrating the principle of a listening setup process in related technologies.
[0042] Figure 3 This is a flowchart of an event handling method provided in an embodiment of this disclosure.
[0043] Figure 4 This is a diagram of an event processing device shown in an embodiment of this disclosure.
[0044] Figure 5 This is a block diagram of an electronic device illustrated in an embodiment of this disclosure. Detailed Implementation
[0045] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0046] The development of two-way binding technology can be divided into the following stages:
[0047] Initial Phase: In the initial version, support for two-way data binding was relatively weak. Developers needed to manually write logic code to handle updates and synchronization between data and the interface, which was inconvenient and error-prone.
[0048] Framework Support Phase: As the Quick App framework continues to improve, two-way data binding technology is better supported. The framework provides some built-in directives and syntax, making data binding and updating simpler and more intuitive. For example, developers can use Vue.js-like directives (such as v-model) to implement two-way data binding.
[0049] Data Model Optimization Phase: With in-depth research and practical application of Quick Apps, two-way data binding technology has been further optimized. In terms of data models, more flexible and efficient data binding mechanisms have been introduced, such as reactive data models. This model can automatically update the relevant interface by monitoring data changes, reducing the workload of manually writing data update logic.
[0050] One approach to using a proxy for monitoring is a type of reactive data model. Figure 1 This is a schematic diagram of a responsive data model in related technologies, such as... Figure 1 As shown, for a target object (data) on the page, a proxy can be created based on the Proxy, thereby enabling the interception and customization of basic operations. For example, based on the object's proxy, getter functions can be associated to intercept access to properties of the data object, and setter functions can be associated to intercept setting properties of the data object. Here, data includes multiple properties, and different properties can be identified using different keywords such as key1, key2, etc. For example... Figure 1 In this context, the proxy object (such as a proxy variable) intercepts the `key1` property of the original data `data` (i.e., the target object) on the page. When the `key1` property is accessed, the getter is triggered, and the electronic device calls the `track` method to establish a listener; when the `key1` property is set, the setter is triggered, and the electronic device calls the `trigger` method to trigger the property setting. It should be noted that operations such as `Array`, `map`, and `delete` within the `data` object are all implemented through the proxy object.
[0051] When an object's proxy performs listening, it does so through the interaction between the application framework layer (JS framework layer, or simply JS layer) and the native service layer. Figure 2 This is an example diagram illustrating the principle of a listening setup process in related technologies. Taking the display of a quick app on the front end as an example, the local service layer parses the application package of the quick app to obtain the virtual DOM (vdom) tree data. When obtaining the vdom tree data, such as... Figure 2As shown, the program creates a specific DOM element, such as a text element, in the native layer using the `dom_create_element` function. After element creation, it calls the `effect` object in the JavaScript layer using `call effectWarp`, then places this object on the stack and sets it as the global variable `activeEffect`. Further, the program calls the `dom_update_element_attribute` function in the native layer to retrieve the attributes of the created DOM element and calls the `call prop function` to read or assign values to these attributes. The program creates a proxy (target) for the DOM element in the JavaScript layer and intercepts read and assign operations through the proxy. If it's a read operation, the program calls `target.key` and triggers the `track` method, adding a dependency to the effect to establish a listener. Figure 2 The portion marked by the dashed box L1 shows how the program binds listeners to the proxy using global variables. Subsequent assignment operations will trigger these bound listeners. The process of establishing listeners essentially establishes a mapping relationship between the target and the ReactiveEffect, linked by activeEffect and activeVmId, and managed through effectStack and vmStack to handle multi-level calls. Figure 2 As shown, in order to establish the mapping between target and ReactiveEffect, some data structures are introduced in the part marked by the dashed box L2 in the JS layer, such as the Map container vmTargetMapobj structure, the TargetMap structure used to get properties, the KeyToDepMap structure used to store the properties of the reactive object, and the Set structure used to store dependencies.
[0052] Therefore, Figure 2 The listening method shown involves many data structures, which are created in the JS layer, consume a lot of memory, have a long access chain, and involve frequent calls between the JS layer and the native layer when triggering the listening, which affects efficiency.
[0053] In response, this disclosure provides an event handling method. Figure 3 This is a flowchart of an event handling method provided in an embodiment of this disclosure, such as... Figure 3 The process, as shown, includes the following steps:
[0054] S11. In response to detecting an access instruction to an object in the page or the memory of the object, a proxy for the object is generated in the local service layer; wherein the memory of the object is located in the local service layer;
[0055] S12. Based on the object's proxy, listen for operation events on the object in the local service layer;
[0056] S13. Respond to operation events on the object in the memory of the page and the object.
[0057] In this embodiment of the disclosure, the entity executing the event processing can be an electronic device capable of running applications, such as user equipment (UE), mobile device, user terminal, mobile phone, tablet computer, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, the event processing method can be implemented by the processor in the terminal device calling computer-readable instructions stored in the memory.
[0058] In this disclosure, the page can be a form page, a quick app page, or a page from any other application; this disclosure does not impose any limitations. Objects on the page can be any page element, and each page element has corresponding memory in the local service layer, where the attribute values of the page elements can be stored.
[0059] In step S11, in response to detecting an access instruction for an object on the page or the object's memory, the electronic device generates a proxy for the object in the local service layer. For example, when a user interacts with the page on the front end, such as clicking or selecting a page element, the electronic device detects an access instruction for an object on the page. Furthermore, when an application actively updates the page display according to a predetermined procedure, such as updating the display content of some page elements, it will actively trigger the updating of the corresponding attribute values of objects in memory; at this time, the electronic device detects an access instruction for the object's memory.
[0060] In this embodiment of the disclosure, the proxy of the object generated in the local service layer intercepts access to the object. In step S12, the electronic device listens for operation events on the object in the local service layer based on the object's proxy. After establishing the listener, the operation events on the object listened to by the object's proxy may include, for example, attribute access events, attribute setting events, events to delete the object, or events to enumerate the object's attribute values, etc. For example, when accessing a certain attribute of the object, the getter is triggered, and the object's proxy calls the track method to establish a listener to listen for whether there is an attribute setting event, thereby triggering the setter.
[0061] In step S13, after the electronic device listens for operation events on the object at the local service layer, it responds to the operation events on the object in both the page and the object's memory.
[0062] For example, after an object's proxy detects an operation that sets an object's attribute, the electronic device can change the attribute value of that object in the local service layer's memory and update the display of the front-end page. As another example, after an object's proxy detects an operation that deletes an object, the electronic device can remove that object from the local service layer's memory and update the display of the front-end page, ensuring that the deleted object is not included in the updated page.
[0063] In this embodiment, automatic synchronization between memory data and the display page is achieved through two-way binding using object proxies, decoupling the memory data side and the display page side. Furthermore, since this embodiment generates object proxies at the local service layer and listens for object operation events at the local service layer without cross-layer listening, compared to generating object proxies at the application framework layer based on complex data structures and frequent interactions between the application framework layer and the local service layer for listening, this reduces the memory footprint of the application framework layer and improves the efficiency of both the page side and the memory side in responding to operation events.
[0064] In some embodiments, listening for operation events on the object at the local service layer according to the object's proxy includes:
[0065] The object's proxy invokes predefined functions in the local service layer to listen for operation events on the object.
[0066] In this embodiment of the disclosure, the predefined functions in the local service layer can be functions built into the operating system, such as the set function, get function, apply function, has, delete, define property, and other methods. Furthermore, the predefined functions can also be functions defined by developers; this embodiment of the disclosure does not impose any limitations.
[0067] Understandably, since the local service layer provides the main feature support to the operating system through C or C++ libraries, the execution efficiency of the local service layer code is high. Therefore, calling predefined functions in the local service layer through object proxies to listen for operation events on the object can improve the efficiency of interception and listening.
[0068] In some embodiments, the step of invoking a predefined function in the local service layer through the proxy of the object and listening for operation events on the object includes:
[0069] The object's proxy invokes a predefined function in the local service layer in the form of a callback function to listen for operation events on the object.
[0070] In this embodiment of the disclosure, as described above, the local service layer provides the operating system with key feature support through a C or C++ library. The local service layer can easily define custom classes, for example, using the lightweight and embeddable JavaScript engine QuickJS. Furthermore, classes can define additional exotic callback functions, such as the JSClassExoticMethods function table built into QuickJS, which covers callback functions like set, get, has, delete, and defineproperty. These functions can be used to easily intercept objects.
[0071] Understandably, since callback functions allow the program to automatically call functions to handle events when they occur, this implementation calls predefined functions in the local service layer in the form of callback functions, making the program more flexible and scalable.
[0072] In some embodiments, listening for operation events on the object at the local service layer according to the object's proxy includes:
[0073] The proxy of the object is pointed to as a pointer to the document object node corresponding to the object in the local service layer, and operation events on the object are listened for.
[0074] A document object node (DOM) is a node in the Document Object Model (DOM). The DOM is used to provide a structured description of a front-end page, transforming it into a collection of structures composed of DOM nodes and objects (containing object properties and methods). In this embodiment, by pointing an object's proxy to the object's DOM node (e.g., a Domelement), the DOM node directly acts as a listener for the object's proxy, allowing the proxy to easily access all the DOM node's properties and methods. For example, the object's proxy can directly call various property keys of the DOM node.
[0075] As mentioned above Figure 2 In a solution where objects are proxied in the JavaScript layer, for example, after a setter is triggered, the trigger logic needs to notify the Domelement object to execute the effect to make the property setting take effect. The updated property value (dom_element_update) in the native layer needs to be wrapped into a JavaScript object for the JavaScript layer to call, such as... Figure 2As shown, it needs to be wrapped with `effectWrap`, and `ReactiveEffect` is a 40-byte object. The JavaScript wrapper also requires 40 bytes. In addition, there are wrapper functions (e.g., wrapper wrappers, 40 bytes each), and other auxiliary data, bringing the total memory usage to at least 200 bytes. Figure 2 In the aforementioned related technologies, a mapping is established between the Target and the ReactiveEffect, that is, the mapping between the object's proxy and each attribute. Since each attribute (key) of the object involves a mapping, it occupies a large amount of memory, with each mapping being approximately 40-50 bytes.
[0076] In this embodiment, a proxy for the object is created in the native service layer and points to the corresponding document object node of the object in the native service layer. Since the pointer occupies 4 bytes, the object's attribute key index occupies 4 bytes, and the overhead of the attribute value vector type is added, it is basically around 8-16 bytes. Moreover, since the object's proxy points to the object's document object node, the object's proxy can share the document object node's options object (including function objects) and only needs to save the dependency pointer, which only requires 4 bytes of overhead and almost no additional overhead.
[0077] In general, in related technologies, listening to one attribute of an object consumes approximately 200-400 bytes of space; while the solution of this disclosure embodiment only requires about 12-16 bytes of space.
[0078] As can be seen from the above, the present disclosure embodiment can greatly save memory overhead by generating a proxy for the object in the local service layer and pointing the proxy to the corresponding document object node in the local service layer in the form of a pointer.
[0079] In some embodiments, in response to the operation event being an event that updates the object, the method further includes:
[0080] The pointer is released after the memory of the page and the object responds to an update of the object.
[0081] In the embodiments of this disclosure, an event that updates an object may be an event that changes the attribute value of the object, an event that deletes the object, or an event that adds an object to the object (i.e., changes the dependency relationship of the document object node corresponding to the object).
[0082] Since in this embodiment of the disclosure, the object's proxy points to the document object node corresponding to the object in the form of a pointer, the electronic device can directly release the pointer to remove the dependency between the object's proxy and the document object node after the page and the object's memory respond to the update of the object.
[0083] It is understood that the method of releasing pointers to remove dependencies in this embodiment is simple and effective. On the one hand, releasing pointers to remove dependencies after responding to operation events can release memory immediately; on the other hand, it can also reduce the occurrence of accidental modification of objects.
[0084] In some embodiments, responding to operation events on the object in the memory of the page and the object includes:
[0085] The local service layer updates the memory of the object based on the operation event; and,
[0086] In the local service layer, the memory of the object is bound to the document object node that uses the memory of the object, and the bound document object node is updated according to the operation event;
[0087] The updated document object node is rendered in the local service layer, and the rendered page is displayed.
[0088] In this embodiment of the disclosure, when the memory side responds to an operation event of an object, since the memory is located in the local service layer, the object's memory can be directly updated based on the operation event at the local service layer. In this embodiment of the disclosure, when the operation event is an event to set an attribute value, updating the object's memory includes updating the data in memory; when the operation event is an event to delete an object, updating the object's memory includes deleting the object's memory.
[0089] In this embodiment, when the page responds to an object's operation event, it is first rendered by the local service layer, and then the rendered page is displayed. During rendering by the local service layer, the electronic device binds the object's memory to the document object nodes that use that memory, ensuring that all document object nodes using that memory can be updated. Updating document object nodes includes modifying node attribute values and may also include adjusting the dependencies between document object nodes in the document object model corresponding to the page. For example, after deleting the object's memory, the corresponding document object nodes no longer exist in the document object model.
[0090] It is understood that in this embodiment of the disclosure, two-way binding is achieved through the proxy of the object generated by the local service layer, so that the display page and memory data can respond quickly and achieve automatic synchronization.
[0091] As mentioned above, in this embodiment of the disclosure, the page can be a quick app page. Since the purpose of quick apps is to provide users with a better experience with lower resource consumption and faster speed, the aforementioned method of this embodiment of the disclosure can be applied to quick apps to further optimize the performance of quick apps.
[0092] Figure 4 This is a diagram illustrating an event handling device according to an embodiment of this disclosure, consisting of... Figure 4 It can be seen that this includes:
[0093] The generation module 101 is configured to generate a proxy for the object in the local service layer in response to detecting an access instruction to an object in the page or the memory of the object; wherein the memory of the object is located in the local service layer;
[0094] Listening module 102 is configured to listen for operation events on the object in the local service layer based on the object's proxy;
[0095] The response module 103 is configured to respond to operation events on the object in the memory of the page and the object.
[0096] In some embodiments, the listening module 102 is further configured to call a predefined function in the local service layer through the proxy of the object to listen for operation events on the object.
[0097] In some embodiments, the listening module 102 is further configured to call a predefined function in the local service layer in the form of a callback function through the proxy of the object to listen for operation events on the object.
[0098] In some embodiments, the listening module 102 is further configured to point the proxy of the object to the document object node corresponding to the object in the local service layer in the form of a pointer, and to listen for operation events on the object.
[0099] In some embodiments, in response to the operation event being an event that updates the object, the apparatus further includes:
[0100] Release module 104 is configured to release the pointer after the memory of the page and the object responds to an update of the object.
[0101] In some embodiments, the response module 103 is further configured to update the memory of the object in the local service layer according to the operation event; and, in the local service layer, bind the memory of the object to a document object node that uses the memory of the object, and update the bound document object node according to the operation event; render the updated document object node in the local service layer, and display the rendered page.
[0102] In some embodiments, the page is a quick app page.
[0103] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0104] Figure 5 This is a block diagram illustrating an electronic device 800 according to an embodiment of this disclosure. For example, the electronic device 800 may be a smartphone, a mobile computer, etc.
[0105] Reference Figure 5 The electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0106] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0107] Memory 804 is configured to store various types of data to support the operation of electronic device 800. Examples of this data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0108] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.
[0109] Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0110] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0111] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0112] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 can detect the on / off state of electronic device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0113] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as Wi-Fi, 4G, or 5G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0114] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0115] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0116] A non-transitory computer-readable storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the aforementioned event handling method.
[0117] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the foregoing claims.
[0118] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. An event processing method, characterized by, The method comprises: in response to detecting an access instruction to an object in a page or a memory of the object, generating an agent of the object at a local service layer; wherein the memory of the object is located at the local service layer; the local service layer is a native layer; listening to an operation event of the object at the local service layer according to the agent of the object; updating the memory of the object at the local service layer according to the operation event; and binding the memory of the object with a document object node using the memory of the object at the local service layer, and updating the bound document object node according to the operation event; rendering the updated document object node at the local service layer, and displaying the rendered page.
2. The method of claim 1, wherein, The listening to the operation event of the object at the local service layer according to the agent of the object comprises: calling a predefined function in the local service layer through the agent of the object to listen to the operation event of the object.
3. The method of claim 2, wherein, The calling a predefined function in the local service layer through the agent of the object to listen to the operation event of the object comprises: calling a predefined function in the local service layer through the agent of the object in the form of a callback function to listen to the operation event of the object.
4. The method of claim 1, wherein, The listening to the operation event of the object at the local service layer according to the agent of the object comprises: pointing the agent of the object to a corresponding document object node of the object in the local service layer in the form of a pointer, and listening to the operation event of the object.
5. The method of claim 4, wherein, In response to the operation event being an event of updating the object, the method further comprises: releasing the pointer after the page and the memory of the object respond to the update of the object.
6. The method of claim 1, wherein, The page is a fast application page.
7. An event processing apparatus, characterized by comprising: The apparatus comprises: a generating module configured to generate an agent of an object in a page or a memory of the object at a local service layer in response to detecting an access instruction to the object or the memory of the object; wherein the memory of the object is located at the local service layer; the local service layer is a native layer; a listening module configured to listen to an operation event of the object at the local service layer according to the agent of the object; a responding module configured to update the memory of the object at the local service layer according to the operation event, and bind the memory of the object with a document object node using the memory of the object at the local service layer, and update the bound document object node according to the operation event; render the updated document object node at the local service layer, and display the rendered page.
8. An electronic device, comprising: comprise: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the method of any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium, comprising: When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can perform the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for synchronizing data
CN110619096A
Page processing method and device, electronic equipment and storage medium
CN115203618A