Compatibility method based on hybrid, adapter, operation device, system and computer-readable storage medium
First Claim
1. A compatibility method based on Hybrid frameworks, wherein, the method comprises:
- a JS adaptation component of a first Hybrid framework acquires a second component data from a JS component of a second Hybrid framework, and the second component data comprises a class name and a method name of a native component of the second Hybrid framework for executing a current business;
the JS adaptation component encapsulates the second component data as a parameter data packet applicable for the first Hybrid framework;
the JS adaptation component transmits a first component data to a bridge module of the first Hybrid framework, and the first component data comprises the parameter data packet and a pre-stored class name and method name of the native adaptation component of the first Hybrid framework corresponding to the JS adaptation component, and the class name and the method name of the native adaptation component are used for the bridge module of the first Hybrid framework to invoke an interface of the corresponding native adaptation component for data transmission;
the corresponding native adaptation component acquires the parameter data packet in the first component data from the bridge module of the first Hybrid framework;
the native adaptation component parses the parameter data packet to acquire the class name and the method name of the native component of the second Hybrid framework;
the native adaptation component invokes an interface of the corresponding native component of the second Hybrid framework according to the class name and the method name of the native component of the second Hybrid framework and according to a preset calling rule of the native component of the second Hybrid framework to implement data transmission, so that the native component of the second Hybrid framework executes the current business;
wherein, the method further comprises;
the native adaptation component acquires a post-mission callback data from the native component of the second Hybrid framework;
the native adaptation component encapsulates the post-mission callback data as a callback data applicable for the first Hybrid framework according to a preset callback rule of the first Hybrid framework;
the native adaptation component sends the encapsulated callback data to the bridge module of the first Hybrid framework;
the JS adaptation component acquires the callback data from the bridge module of the first Hybrid framework;
the JS adaptation component sends the acquired callback data to the JS component of the second Hybrid framework according to a preset callback rule of the JS component of the second Hybrid framework.
1 Assignment
0 Petitions
Accused Products
Abstract
Disclosed are a compatibility method based on Hybrid, an adapter, an operation device, a system and a computer-readable storage medium, wherein, the method comprises: a JS adaptation component acquires a second component data from a JS component of a second Hybrid; the JS adaptation component encapsulates the second component data as a parameter data packet applicable for the first Hybrid; the JS adaptation component transmits a first component data to a bridge module of the first Hybrid; the native adaptation component acquires the parameter data packet from the bridge module; the native adaptation component parses the parameter data packet to acquire the class name and the method name; the native adaptation component invokes an interface of the native component of the corresponding second Hybrid according to the class name and the method name and according to a preset calling rule.
27 Citations
13 Claims
-
1. A compatibility method based on Hybrid frameworks, wherein, the method comprises:
-
a JS adaptation component of a first Hybrid framework acquires a second component data from a JS component of a second Hybrid framework, and the second component data comprises a class name and a method name of a native component of the second Hybrid framework for executing a current business; the JS adaptation component encapsulates the second component data as a parameter data packet applicable for the first Hybrid framework; the JS adaptation component transmits a first component data to a bridge module of the first Hybrid framework, and the first component data comprises the parameter data packet and a pre-stored class name and method name of the native adaptation component of the first Hybrid framework corresponding to the JS adaptation component, and the class name and the method name of the native adaptation component are used for the bridge module of the first Hybrid framework to invoke an interface of the corresponding native adaptation component for data transmission; the corresponding native adaptation component acquires the parameter data packet in the first component data from the bridge module of the first Hybrid framework; the native adaptation component parses the parameter data packet to acquire the class name and the method name of the native component of the second Hybrid framework; the native adaptation component invokes an interface of the corresponding native component of the second Hybrid framework according to the class name and the method name of the native component of the second Hybrid framework and according to a preset calling rule of the native component of the second Hybrid framework to implement data transmission, so that the native component of the second Hybrid framework executes the current business; wherein, the method further comprises; the native adaptation component acquires a post-mission callback data from the native component of the second Hybrid framework; the native adaptation component encapsulates the post-mission callback data as a callback data applicable for the first Hybrid framework according to a preset callback rule of the first Hybrid framework; the native adaptation component sends the encapsulated callback data to the bridge module of the first Hybrid framework; the JS adaptation component acquires the callback data from the bridge module of the first Hybrid framework; the JS adaptation component sends the acquired callback data to the JS component of the second Hybrid framework according to a preset callback rule of the JS component of the second Hybrid framework. - View Dependent Claims (2, 3)
-
-
4. An adapter, wherein, the adapter is disposed in a first Hybrid framework, for making a second Hybrid framework compatible with the first Hybrid framework, and the adapter comprises a JS adaptation component and a native adaptation component, and the JS adaptation component comprises a first receiving unit, a first encapsulating unit and a first invoking unit, and the native adaptation component comprises a second receiving unit, a parsing unit, and a second invoking unit,
the first receiving unit is used for acquiring a second component data from a JS component of the second Hybrid framework, and the second component data comprises a class name and a method name of a native component of the second Hybrid framework for executing a current business; -
the first encapsulating unit is used for encapsulating the second component data as a parameter data packet applicable for the first Hybrid framework; the first invoking unit is used for transmitting a first component data to a bridge module of the first Hybrid framework, and the first component data comprises the parameter data packet and a pre-stored class name and method name of the native adaptation component of the first Hybrid framework corresponding to the JS adaptation component, and the class name and the method name of the native adaptation component are used for the bridge module of the first Hybrid framework to invoke an interface of the corresponding native adaptation component for data transmission; the second receiving unit is used for the corresponding native adaptation component to acquire the parameter data packet in the first component data from the bridge module of the first Hybrid framework; the parsing unit is used for parsing the parameter data packet to acquire the class name and the method name of the native component of the second Hybrid framework; the second invoking unit is used for invoking an interface of the corresponding native component of the second Hybrid framework according to the class name and the method name of the native component of the second Hybrid framework and according to a preset calling rule of the native component of the second Hybrid framework to implement data transmission, so that the native component of the second Hybrid framework executes the current business; wherein, the JS adaptation component further comprises a first callback unit and a first sending unit; and
the native adaptation component comprises a second callback unit, a second encapsulating unit, and a second sending unit,the second callback unit is used for acquiring a post-mission callback data from the native component of the second Hybrid framework; the second encapsulating unit is used for encapsulating the post-mission callback data as a callback data applicable for the first Hybrid framework according to a preset callback rule of the first Hybrid framework; the second sending unit is used for sending the encapsulated callback data to the bridge module of the first Hybrid framework; the first sending unit is used for acquiring the callback data from the bridge module of the first Hybrid framework; the first callback unit is used for the JS adaptation component to send the acquired callback data to the JS component of the second Hybrid framework according to a preset callback rule of the JS component of the second Hybrid framework. - View Dependent Claims (5, 6)
-
-
7. An operation system based on Hybrid frameworks, wherein, the operation system comprises a first Hybrid framework and a second Hybrid framework, and the first Hybrid framework comprises an adapter and a bridge module, ant the adapter comprises a JS adaptation component and a native adaptation component, and the bridge module of the first Hybrid framework is used to connect the JS adaptation component and the native adaptation component, and the JS adaptation component is used to connect a JS component of the second Hybrid framework and the bridge module of the first Hybrid framework, and the native adaptation component is used to connect the bridge module of the first Hybrid framework and a native component of the second Hybrid framework, and the system further comprises one or more processors and a memory, and the processor and the memory are connected by a bus;
-
wherein, the memory is used to store a program for realizing the first Hybrid framework, the second Hybrid framework and a communication between the first Hybrid framework and the second Hybrid framework; the processor is used to execute the program stored in the memory for realizing the first Hybrid framework, the second Hybrid framework and the communication between the first Hybrid framework and the second Hybrid framework, to perform the following operations; acquiring a second component data from a JS component of a second Hybrid framework; encapsulating the second component data as a parameter data packet applicable for a first Hybrid framework; transmitting a first component data to a bridge module of the first Hybrid framework, and the first component data comprises the parameter data packet and a pre-stored class name and method name of a native adaptation component corresponding to a JS adaptation component; transmitting the first component data to a native layer; invoking a native adaptation interface of the corresponding native adaptation component of the first Hybrid framework according to the class name and method name of the native adaptation component in the first component data to implement data transmission; acquiring the parameter data packet in the first component data from the bridge module of the first Hybrid framework; parsing the parameter data packet to acquire a class name and a method name of a native component of the second Hybrid framework; invoking an interface of the corresponding native component of the second Hybrid framework according to the class name and the method name of the native component of the second Hybrid framework and according to a preset calling rule of the native component of the second Hybrid framework to implement data transmission, so that the native component of the second Hybrid framework executes the current business; wherein, if a data needs to be called back after executing the current business, the processor further performs the following operations; acquiring a post-mission callback data from the native component of the second Hybrid framework; encapsulating the post-mission callback data as a callback data applicable for the first Hybrid framework according to a preset callback rule of the first Hybrid framework; sending the callback data to the bridge module of the first Hybrid framework; acquiring the callback data from the bridge module of the first Hybrid framework; sending the acquired callback data to the JS component of the second Hybrid framework according to the preset callback rule of the JS component of the second Hybrid framework. - View Dependent Claims (8, 9, 10, 11, 12, 13)
-
Specification