METHOD AND SYSTEM FOR RENDERING USER INTERFACES
Rendering user interfaces is disclosed including acquiring, using a first thread, a to-be-handled user interface render event, the first thread being a thread on a dynamic language application runtime platform, and the dynamic language application runtime platform being preloaded with a render engine, and calling, using the first thread, a corresponding user interface rendering function provided by the render engine based on an interface that corresponds to the event and that is used to call the render engine.
1 . A method, comprising:
acquiring, using a first thread, a to-be-handled user interface render event, wherein the first thread is a thread on a dynamic language application runtime platform, and wherein the dynamic language application runtime platform is preloaded with a render engine; and
calling, using the first thread, a corresponding user interface rendering function provided by the render engine based on an interface that corresponds to the event and that is used to call the render engine.
2 . The method as described in claim 1 , wherein:
the dynamic language application runtime platform is further preloaded with common modules; and
the method further comprises:
calling, using the first thread, a corresponding common function provided by a common module based on the interface that corresponds to the event and that is used to call the common module.
3 . The method as described in claim 2 , wherein the common modules comprise one or more of the following modules:
a network module configured to provide a network connection function; and/or
a system module configured to provide a system service function.
4 . The method as described in claim 1 , wherein:
the interface provided by the render engine comprises a first language interface;
the first language interface is mapped to a second language interface;
the first language interface is used to call the corresponding user interface rendering function provided in the render engine in the first language;
the second language is a dynamic language supported by the dynamic language application runtime platform;
the calling of the corresponding user interface rendering function provided by the render engine comprises:
acquiring, using the first thread, the second language interface that corresponds to the event and that is used to call the render engine;
accessing a mapping of the acquired second language interface to the corresponding first language interface; and
calling the corresponding user interface rendering function provided by the render engine based on the mapped first language interface.
5 . The method as described in claim 4 , wherein the calling of the corresponding user interface rendering function provided by the render engine comprises:
sending, using the first thread, a call instruction to a virtual machine, wherein the call instruction comprises a second language interface used to call the render engine, and wherein the call instruction triggers the virtual machine to map the second language interface to the corresponding first language interface; and
calling the corresponding user interface rendering function provided by the render engine based on the mapped first language interface.
6 . The method as described in claim 1 , wherein the acquiring of the to-be-handled user interface render event comprises:
acquiring the to-be-handled user interface render event from a dynamic language application runtime platform event queue upon receiving a callback function notification, wherein the callback function notifies the first thread in response to a determination that the user interface render event enters the event queue.
7 . The method as described in claim 6 , further comprising:
receiving, using a second thread, an operating system-related event from the operating system; and
storing the operating system-related event in the event queue, wherein the operating system-related event comprises a user interface render event.
8 . The method as described in claim 1 , further comprising:
in response to a determination that the dynamic language application runtime platform starts:
mapping a first language interface provided by the render engine to a second language interface; and
storing information on a mapping relationship between the first language interface provided by the render engine and the mapped second language interface; and
loading the interface-mapped render engine onto the dynamic language application runtime platform.
9 . The method as described in claim 4 , wherein:
the dynamic language application runtime platform comprises Node.js; and
the second language comprises JavaScript.
10 . A system, comprising:
a processor; and
a memory coupled with the processor, wherein the memory is configured to provide the processor with instructions which when executed cause the processor to:
acquire, using a first thread, a to-be-handled user interface render event, wherein the first thread is a thread on a dynamic language application runtime platform, and wherein the dynamic language application runtime platform is preloaded with a render engine; and
call, using the first thread, a corresponding user interface rendering function provided by the render engine based on an interface that corresponds to the event and that is used to call the render engine.
11 . The system as described in claim 10 , wherein:
the dynamic language application runtime platform is further preloaded with common modules; and
the processor is further configured to:
call, using the first thread, a corresponding common function provided by a common module based on the interface that corresponds to the event and that is used to call the common module.
12 . The system as described in claim 10 , wherein:
the interface provided by the render engine comprises a first language interface;
the first language interface is mapped to a second language interface;
the first language interface is used to call the corresponding user interface rendering function provided in the render engine in the first language;
the second language is a dynamic language supported by the dynamic language application runtime platform;
the calling of the corresponding user interface rendering function provided by the render engine comprises to:
acquire, using the first thread, the second language interface that corresponds to the event and that is used to call the render engine;
access a mapping of the acquired second language interface to the corresponding first language interface; and
call the corresponding user interface rendering function provided by the render engine based on the mapped first language interface.
13 . The system as described in claim 12 , the calling of the corresponding user interface rendering function provided by the render engine comprises to:
send, using the first thread, a call instruction to a virtual machine, wherein the call instruction comprises a second language interface used to call the render engine, and wherein the call instruction triggers the virtual machine to map the second language interface to the corresponding first language interface; and
call the corresponding user interface rendering function provided by the render engine based on the mapped first language interface.
14 . The system as described in claim 10 , wherein the acquiring of the to-be-handled user interface render event comprises to:
acquire the to-be-handled user interface render event from a dynamic language application runtime platform event queue upon receiving a callback function notification, wherein the callback function notifies the first thread in response to a determination that the user interface render event enters the event queue.
15 . The system as described in claim 12 , wherein:
the dynamic language application runtime platform comprises Node.js; and
the second language comprises JavaScript.
16 . A computer program product being embodied in a tangible non-transitory computer readable storage medium and comprising computer instructions for:
acquiring, using a first thread, a to-be-handled user interface render event, wherein the first thread is a thread on a dynamic language application runtime platform, and wherein the dynamic language application runtime platform is preloaded with a render engine; and
calling, using the first thread, a corresponding user interface rendering function provided by the render engine based on an interface that corresponds to the event and that is used to call the render engine.