Data sharing method and system, electronic equipment, storage medium and program product

By injecting transit functions into front-end development and using a unified data provider, the problem that the components of native system of different front-end frameworks cannot be shared is solved, and development efficiency and stability are improved.

CN119003082APending Publication Date: 2024-11-22MIDEA GROUP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310577852.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-22
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

In front-end development, the native system components corresponding to different front-end frameworks cannot be shared, resulting in inefficient development.

Method used

By injecting a redirect function into the entity object and receiving the call parameters sent by the front-end interface, searching and calling back the native component data required by the front-end interface in the data supply body, and using pre-registered combination components in different native systems to form a unified data supply , which enables different front-end frameworks to call the native system components corresponding to other front-end frameworks through the relay function.

Benefits of technology

It realizes the sharing of native system components corresponding to different front-end frameworks, improves the efficiency and stability of front-end development, and reduces the cost of subsequent system maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003082A_ABST
    Figure CN119003082A_ABST
Patent Text Reader

Abstract

The invention relates to the field of data sharing, and provides a data sharing method and system, electronic equipment, a storage medium and a program product. The method comprises the following steps: injecting a transfer function into an entity object; receiving a calling parameter sent by the front-end interface, and searching and callback native component data required by the front-end interface in the data supply body according to the calling parameter; the calling parameter is an input parameter when the transfer function is called by the front-end interface, and the data supply body is a combination of pre-registered native components in different native systems. According to the method, the native components in different native systems are combined in advance to form a uniform data supply body, so that a certain front-end framework can call the native system components corresponding to other front-end frameworks in the data supply body through a transfer function during hybrid development of a front-end page, and the data supply body is more flexible. Namely, the native system components corresponding to different front-end frames can be shared through the same data supplier, and the front-end development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data sharing, and in particular to a data sharing method, system, electronic device, storage medium and program product. Background Art

[0002] Native systems usually have a variety of components, each with its own specific functions. Native systems provide mature and stable methods for implementing the functions of each component for use in various business scenarios. In front-end development, if you need to use the function of a component, you can call the native system component corresponding to the front-end framework to implement it.

[0003] However, current front-end development usually adopts a hybrid development model, that is, it uses multiple front-end frameworks for development, and different front-end frameworks correspond to different native systems. This results in a front-end framework being unable to call the native system components corresponding to other front-end frameworks during the front-end development process, that is, the native system components corresponding to different front-end frameworks cannot be shared, affecting the efficiency of front-end development. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the related art. To this end, the present invention proposes a data sharing method, so that native system components corresponding to different front-end frameworks can be shared through the same data provider, thereby improving the efficiency of front-end development.

[0005] The invention also provides a data sharing method, system, electronic device, storage medium and program product.

[0006] According to a first aspect of the present invention, a data sharing method includes:

[0007] Injecting a transfer function into an entity object; the entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameter of the front-end interface;

[0008] Receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters;

[0009] The calling parameter is an input parameter when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems.

[0010] According to the data sharing method of an embodiment of the present invention, a transfer function is first injected into the entity object, and then the call parameters sent by the front-end interface are received, and the native component data required by the front-end interface is searched and called back in the data provider according to the call parameters, wherein the call parameters are input parameters when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems. Since the native components in different native systems are combined in advance to form a unified data provider, during the mixed development of front-end pages, a front-end framework can call the native system components corresponding to other front-end frameworks in the data provider through the transfer function, that is, the native system components corresponding to different front-end frameworks can be shared through the same data provider, thereby improving the efficiency of front-end development.

[0011] According to an embodiment of the present invention, searching and calling back the native component data required by the front-end interface in the data provider according to the calling parameters includes:

[0012] Parsing the calling parameters to obtain parsing results;

[0013] Searching the data provider for a target native component that matches the parsing result;

[0014] Creating a native component instance in the entity object according to the target native component;

[0015] Passing the parameters of the native component instance into the target native function corresponding to the native component instance;

[0016] The execution result data of the target native function is called back to the front-end interface.

[0017] According to an embodiment of the present invention, before calling back the execution result data of the target native function to the front-end interface, the method includes:

[0018] According to the target bridge identifier, searching for the execution result data of the target native function in the corresponding entity object;

[0019] The target bridging identifier is a bridging identifier that is created in advance and is the same as the bridging identifier of the entity object.

[0020] According to an embodiment of the present invention, calling back the execution result data of the target native function to the front-end interface includes:

[0021] Using a preset callback function of the front-end interface, calling back the execution result data of the target native function to a preset receiving function of the front-end interface;

[0022] The calling parameter includes an identifier of the preset callback function, and the identifier of the preset callback function corresponds to an identifier of the preset receiving function.

[0023] According to a second aspect of the present invention, a data sharing method includes:

[0024] Sending a call parameter to a transfer function; the transfer function is pre-injected into an entity object, and the transfer function is a pre-set function that matches the format of the call parameter, the entity object is pre-created in a native container, and the call parameter is an input parameter when calling the transfer function;

[0025] Receive native component data in a data provider of the native container callback; the data provider is a combination of native components in different pre-registered native systems.

[0026] According to an embodiment of the present invention, the receiving of native component data in the data provider of the native container callback includes:

[0027] Using a preset receiving function to receive the native component data in the data provider called back by a preset callback function from the native container;

[0028] The calling parameter includes an identifier of the preset callback function, and the identifier of the preset callback function corresponds to an identifier of the preset receiving function.

[0029] A data sharing system according to a third aspect of an embodiment of the present invention includes: a native container and a front-end interface;

[0030] The native container is used to:

[0031] Injecting a transfer function into an entity object; the entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameter of the front-end interface;

[0032] Receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters;

[0033] The calling parameter is an input parameter when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems;

[0034] The front-end interface is used to:

[0035] Send calling parameters to the transfer function;

[0036] Receive the native component data in the data provider of the native container callback.

[0037] According to an embodiment of the fourth aspect of the present invention, an electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, it implements any of the data sharing methods described above.

[0038] According to the non-transitory computer-readable storage medium of the fifth aspect of the present invention, a computer program is stored thereon, and when the computer program is executed by a processor, the data sharing method as described in any one of the above is implemented.

[0039] According to a sixth aspect of the present invention, a computer program product comprises a computer program, which, when executed by a processor, implements any of the above-described data sharing methods.

[0040] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:

[0041] First, inject the transfer function into the entity object, then receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters, where the call parameters are the input parameters when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems. Since the native components in different native systems are combined in advance to form a unified data provider, during the mixed development of front-end pages, a front-end framework can call the native system components corresponding to other front-end frameworks in the data provider through the transfer function, that is, the native system components corresponding to different front-end frameworks can be shared through the same data provider, thereby improving the efficiency of front-end development.

[0042] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 This is one of the flow charts of the data sharing method provided by the embodiment of the present invention;

[0045] Figure 2 This is the second flow chart of the data sharing method provided by the embodiment of the present invention;

[0046] Figure 3 This is the third flow chart of the data sharing method provided by the embodiment of the present invention;

[0047] Figure 4 is an operational architecture diagram of a data sharing system provided by an embodiment of the present invention;

[0048] Figure 5 is a data management mode diagram of a data sharing system provided by an embodiment of the present invention;

[0049] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] The following embodiments of the present invention are described in further detail in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0051] In the description of the embodiments of the present invention, it should be noted that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the embodiments of the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as limitations on the embodiments of the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.

[0052] In the description of the embodiments of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the embodiments of the present invention can be understood according to specific circumstances.

[0053] In the embodiments of the present invention, unless otherwise clearly specified and limited, the first feature being "above" or "below" the second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, the first feature being "above", "above" and "above" the second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. The first feature being "below", "below" and "below" the second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.

[0054] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0055] Figure 1 This is one of the flow charts of the data sharing method provided by the embodiment of the present invention. Figure 1 , the embodiment of the present application provides a data sharing method, which may include:

[0056] 101. Inject the transfer function into the entity object;

[0057] The entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameters of the front-end interface;

[0058] 102. Receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters.

[0059] The calling parameters are the input parameters when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems.

[0060] In step 101, the native container creates an entity object inside it in advance, and then injects a transfer function into the entity object through the JS engine. The transfer function is a function pre-set by the native container to match the format of the calling parameters of the front-end interface. The format is the structure of the transfer function, including the type and number of parameters in the transfer function.

[0061] It should be noted that the number and type of parameters of the transfer function can be set according to requirements and are not limited here. In this embodiment, the number of parameters of the transfer function can be four, and the parameter types can be native component name, native function name, native function related parameters and native component option parameters.

[0062] In addition, native components include but are not limited to native modules and native plug-ins, that is, the data provider can be a combination of native modules of different front-end frameworks corresponding to native systems, or a combination of native plug-ins of different front-end frameworks corresponding to native systems, or a combination of native modules and native plug-ins of different front-end frameworks corresponding to native systems. The parameter types in this embodiment can be native module name / native plug-in name, native function name, native function related parameters and native module option parameters / native plug-in option parameters.

[0063] In the data provider, multiple native modules from different front-end frameworks are uniformly managed by the mobile terminal application, including native module registration, native function definition corresponding to the native module, native module query and native module call. When the mobile terminal application is started, the global module management class manages the registration of all native modules globally; the native function definition corresponding to the native module includes: native module name definition, native function name definition corresponding to the native module, native function related parameter definition corresponding to the native module and native module option parameter definition.

[0064] Similarly, in the data provider, multiple native plug-ins from different front-end frameworks are also managed uniformly by the mobile terminal application. The management content includes native plug-in registration, native function definition corresponding to the native plug-in, native plug-in query and native plug-in call. When the mobile terminal application is started, the global plug-in management class manages the registration of all native plug-ins globally; the native function definition corresponding to the native plug-in includes: native plug-in name definition, native function name definition corresponding to the native plug-in, native function related parameter definition corresponding to the native plug-in and native plug-in option parameter definition.

[0065] In step 102, if the front-end interface wants to call a native module, the calling parameters it sends may include the native module name, the native function name corresponding to the native module, the native function-related parameters corresponding to the native module, and the native module option parameters; if the front-end interface wants to call a native plug-in, the calling parameters it sends may include the native plug-in name, the native function name corresponding to the native plug-in, the native function-related parameters corresponding to the native plug-in, and the native plug-in option parameters.

[0066] Weex is a cross-platform mobile interface design framework. Weex developers can use web-like syntax to build iOS, Android, and Web applications, allowing mobile developers to write native-level performance experiences using simple H5 syntax.

[0067] The OpenHarmony ArkUI framework is another open source interface design and development framework that provides developers with the necessary capabilities for application interface design and development, including interface design components, animation, drawing, interactive events, etc., and can build iOS, Android and OpenHarmony applications.

[0068] Vue is a progressive framework for building user interfaces. It is easy to learn, has excellent performance, and is suitable for a variety of web front-end frameworks.

[0069] However, since the Weex framework, OpenHarmony ArkUI framework, and Vue framework have different corresponding native systems, when conducting front-end hybrid development, the native system modules and plug-ins corresponding to these front-end frameworks cannot be shared among these front-end frameworks, thus affecting the efficiency of front-end development.

[0070] This embodiment first injects a transfer function into the entity object, then receives the call parameters sent by the front-end interface, and searches and calls back the native component data required by the front-end interface in the data provider according to the call parameters, wherein the call parameters are the input parameters when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems. Since the native components in different native systems are combined in advance to form a unified data provider, during the mixed development of front-end pages, a front-end framework can call the native system components corresponding to other front-end frameworks in the data provider through the transfer function, that is, the native system components corresponding to different front-end frameworks can be shared through the same data provider, thereby improving the efficiency of front-end development. It is suitable for a variety of front-end frameworks and various JS engines including the Weex framework, OpenHarmonyArkUI framework and Vue framework.

[0071] In addition, since the native system components corresponding to different front-end frameworks can be shared, the stability of front-end development is improved and the cost of subsequent system maintenance is reduced.

[0072] Figure 2 This is the second flow chart of the data sharing method provided by the embodiment of the present invention. Figure 2 In one embodiment, searching and calling back the native component data required by the front-end interface in the data provider according to the calling parameters includes:

[0073] 201. Parse the call parameters and obtain the parsing results;

[0074] 202. Searching the data provider for a target native component that matches the parsing result;

[0075] 203. Create a native component instance in the entity object according to the target native component;

[0076] 204. Pass the parameters of the native component instance into the target native function corresponding to the native component instance;

[0077] 205. Call back the execution result data of the target native function to the front-end interface.

[0078] In step 202, if a native component parameter is found in the data provider that matches the parsed call parameter, the native component is determined to be the target native component.

[0079] For example, if the module name, the corresponding native function name, the corresponding native function related parameters and the module option parameters of a native module A found in the data provider all match the native module name, the native function name, the native function related parameters and the native module option parameters requested to be called after parsing, then the native module A is determined to be the target native module;

[0080] Similarly, if the plugin name, corresponding native function name, corresponding native function related parameters and plugin option parameters of a native plugin B found in the data provider all match the native plugin name, the native function name corresponding to the native plugin, the native function related parameters and native plugin option parameters requested to be called after parsing, then the native plugin B is determined to be the target native plugin;

[0081] In this embodiment, the front end sends the calling parameters, finds the corresponding native component in the data provider, creates the corresponding instance, executes the corresponding native function, obtains the native component data required by the front end, and realizes the shared calling of the native component data corresponding to various native systems by different front-end frameworks.

[0082] In one embodiment, before calling back the execution result data of the target native function to the front-end interface, the process includes:

[0083] According to the target bridge identifier, search for the execution result data of the target native function in the corresponding entity object;

[0084] The target bridge ID is a pre-created bridge ID that is identical to the entity object's bridge ID.

[0085] A native container corresponds to an entity object, so it is necessary to establish a bridge identifier between the native container and the entity object, that is, to establish the same identifier for the corresponding native container and entity object, so that when the front-end interface sends a call request to the native container, the native container can quickly find the corresponding transit function in the corresponding entity object, and use the transit function as the entry function to pass the call parameters. After the corresponding native function is executed, the native container quickly finds the execution result in the entity object through the bridge identifier and calls back to the front-end interface.

[0086] It should be noted that the form or type of the bridge identifier can be set according to requirements and is not limited here. In this embodiment, the address of the native container can be used as the bridge identifier.

[0087] This embodiment establishes a bridge identifier between the native container and the entity object, so that the native container and the entity object can correspond to each other, and the front-end interface can quickly and accurately call the native component data.

[0088] In one embodiment, the execution result data of the target native function is called back to the front-end interface, including

[0089] Using the preset callback function of the front-end interface, the execution result data of the target native function is called back to the preset receiving function of the front-end interface;

[0090] The calling parameters include an identifier of a preset callback function, and the identifier of the preset callback function corresponds to an identifier of a preset receiving function.

[0091] When the front-end interface sends the call parameters to the transit function, the identifier of the preset callback function is also sent at the same time. When the native container uses the callback function to call back the execution result data of the target native function to the front-end interface, the identifier of the preset callback function is also called back to the front-end interface. Since the identifier of the preset callback function corresponds to the identifier of the preset receiving function, the receiving function of the front-end interface can confirm whether the callback data is called back by the corresponding preset callback function based on the preset callback function identifier of the callback, thereby judging the accuracy of the callback data and avoiding callback errors.

[0092] A calling script is pre-set in the entity object as the entry of the callback function to call the callback function.

[0093] It should be noted that the identifier of the preset callback function and the identifier of the preset receiving function are both set in ascending values, which ensures the uniqueness of each callback function and receiving function and can ensure a one-to-one correspondence between the callback function and the receiving function.

[0094] This embodiment uses a preset callback function identifier and a preset receiving function identifier to correspond the preset callback function and the preset receiving function one-to-one, and transmits the preset callback function identifier during the entire native data calling process, which can facilitate the receiving function of the front-end interface to judge the accuracy of the callback data according to the identifier.

[0095] Figure 3 This is the third flow chart of the data sharing method provided by the embodiment of the present invention. Figure 3 , the embodiment of the present application provides a data sharing method, which may include:

[0096] 301. Send calling parameters to the transfer function;

[0097] The transfer function is pre-injected into the entity object, and the transfer function is a pre-set function that matches the format of the call parameter. The entity object is pre-created in the native container, and the call parameter is the input parameter when calling the transfer function;

[0098] 302. Receive native component data in the data provider of the native container callback.

[0099] Data providers are pre-registered combinations of native components from different native systems.

[0100] In step 301, the calling parameters sent by the front-end interface to the transfer function can be set according to the requirements, which is not limited here. In this embodiment, the calling parameters sent to the transfer function may include the native component name, the native function name, the native function related parameters and the native component option parameters;

[0101] Furthermore, if the front-end interface wants to call a certain native module, the calling parameters sent to the transit function may include the native module name, the native function name corresponding to the native module, the native function-related parameters corresponding to the native module, and the native module option parameters; if the front-end interface wants to call a certain native plug-in, the calling parameters sent to the transit function may include the native plug-in name, the native function name corresponding to the native plug-in, the native function-related parameters corresponding to the native plug-in, and the native plug-in option parameters.

[0102] This embodiment first sends a call parameter to the transfer function, and then receives the native component data in the data provider of the native container callback, where the call parameter is the input parameter when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems. Since the native components in different native systems are combined in advance to form a unified data provider, during the mixed development of front-end pages, a front-end framework can call the native system components corresponding to other front-end frameworks in the data provider through the transfer function, that is, the native system components corresponding to different front-end frameworks can be shared through the same data provider, which improves the efficiency of front-end development. It is suitable for a variety of front-end frameworks and various JS engines including Weex framework, OpenHarmony ArkUI framework and Vue framework.

[0103] In addition, since the native system components corresponding to different front-end frameworks can be shared, the stability of front-end development is improved and the cost of subsequent system maintenance is reduced.

[0104] In one embodiment, the native component data in the data provider receiving the native container callback may include:

[0105] Using a preset receiving function to receive the native component data in the data provider called back from the native container by a preset callback function;

[0106] The calling parameters include an identifier of a preset callback function, and the identifier of the preset callback function corresponds to an identifier of a preset receiving function.

[0107] When the front-end interface sends the call parameters to the transit function, it also sends the identifier of the preset callback function. When the front-end interface receives the execution result data of the target native function, it also receives the identifier of the preset return function. Since the identifier of the preset callback function corresponds to the identifier of the preset receiving function, the receiving function of the front-end interface can confirm whether the callback data is called back by the corresponding preset callback function based on the preset callback function identifier of the callback, thereby judging the accuracy of the callback data and avoiding callback errors.

[0108] It should be noted that the identifier of the preset callback function and the identifier of the preset receiving function are both set in ascending values, which ensures the uniqueness of each callback function and receiving function and can ensure a one-to-one correspondence between the callback function and the receiving function.

[0109] This embodiment uses a preset callback function identifier and a preset receiving function identifier to correspond the preset callback function and the preset receiving function one-to-one, and transmits the preset callback function identifier during the entire native data calling process, which can facilitate the receiving function of the front-end interface to judge the accuracy of the callback data according to the identifier.

[0110] Figure 4 is an operational architecture diagram of a data sharing system provided by an embodiment of the present invention;

[0111] Figure 5 is a data management mode diagram of a data sharing system provided by an embodiment of the present invention;

[0112] Reference Figure 4 , an embodiment of the present application provides a data sharing system, which may include: a native container and a front-end interface;

[0113] Native containers are used for:

[0114] Inject the transfer function into the entity object;

[0115] The entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameters of the front-end interface;

[0116] Receive the call parameters sent by the front-end interface, search and call back the native component data required by the front-end interface in the data provider according to the call parameters;

[0117] The call parameters are the input parameters when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems;

[0118] The front-end interface is used to:

[0119] Send calling parameters to the transfer function;

[0120] Receives native component data from the data provider of the native container callback.

[0121] Specifically, the communication process between the native container and the front-end interface is as follows:

[0122] After starting the mobile terminal application, the mobile terminal is controlled to complete the registration of all modules and plug-ins in the data provider, and initialize the native container and JS engine. The data provider is a combination of pre-registered native components in different native systems.

[0123] 1. The native container creates an entity object and establishes a bridge identifier between the entity object;

[0124] 2. The native container uses the JS engine to inject a transfer function into the entity object;

[0125] 3. The front-end interface sends calling parameters to the transfer function, including the native module name / native plug-in name, the native function name corresponding to the native module / native plug-in, the native function related parameters corresponding to the native module / native plug-in, the native module / native plug-in option parameters, and the preset callback function identifier;

[0126] 4. Native container parses call parameters;

[0127] 5. The native container matches the target native module / target native plug-in in the data provider according to the parsing results;

[0128] 6. The native container creates a module instance / plug-in instance in the entity object according to the target native module / target native module;

[0129] 7. The native container passes the parameters of the module instance / plug-in instance to the target native function corresponding to the module instance / plug-in instance and executes the target native function;

[0130] 8. The native container calls back the execution result data of the target native function to the preset receiving function of the front-end interface through the preset callback function and bridge identifier;

[0131] 9. The front-end interface receives the execution result data, and performs logical processing and display on the execution result data.

[0132] When using a mobile terminal application to control a smart device, the application front-end interface can use the data sharing system of this embodiment to call the required plug-in to control the device. After the plug-in executes the native function, the execution result data is uploaded to the cloud, and the cloud then calls the execution result data back to the front-end interface for processing.

[0133] In addition, refer to Figure 5 ,The mobile terminal application manages the native modules, native plug-ins and entity objects separately to improve the ,efficiency of front-end interface calls and native container responses.

[0134] Since the present embodiment combines the native components in different native systems in advance to form a unified data provider, during the mixed development of front-end pages, a front-end framework can call the native system components corresponding to other front-end frameworks in the data provider through a transit function, that is, the native system components corresponding to different front-end frameworks can be shared through the same data provider, thereby improving the efficiency of front-end development. It is suitable for a variety of front-end frameworks and various JS engines including the Weex framework, OpenHarmonyArkUI framework and Vue framework.

[0135] In addition, since the native system components corresponding to different front-end frameworks can be shared, the stability of front-end development is improved and the cost of subsequent system maintenance is reduced.

[0136] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6As shown, the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 830 and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the following method:

[0137] Injecting a transfer function into an entity object; the entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameter of the front-end interface;

[0138] Receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters;

[0139] The calling parameter is an input parameter when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems; or

[0140] Sending a call parameter to a transfer function; the transfer function is pre-injected into an entity object, and the transfer function is a pre-set function that matches the format of the call parameter, the entity object is pre-created in a native container, and the call parameter is an input parameter when calling the transfer function;

[0141] Receive native component data in a data provider of the native container callback; the data provider is a combination of native components in different pre-registered native systems.

[0142] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0143] On the other hand, an embodiment of the present invention discloses a computer program product, wherein the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, wherein the computer program includes program instructions. When the program instructions are executed by a computer, the computer can perform the methods provided by the above-mentioned method embodiments, for example, including:

[0144] Injecting a transfer function into an entity object; the entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameter of the front-end interface;

[0145] Receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters;

[0146] The calling parameter is an input parameter when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems; or

[0147] Sending a call parameter to a transfer function; the transfer function is pre-injected into an entity object, and the transfer function is a pre-set function that matches the format of the call parameter, the entity object is pre-created in a native container, and the call parameter is an input parameter when calling the transfer function;

[0148] Receive native component data in a data provider of the native container callback; the data provider is a combination of native components in different pre-registered native systems.

[0149] In another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the transmission method provided in the above embodiments, for example, including:

[0150] Injecting a transfer function into an entity object; the entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameter of the front-end interface;

[0151] Receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters;

[0152] The calling parameter is an input parameter when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems; or

[0153] Sending a call parameter to a transfer function; the transfer function is pre-injected into an entity object, and the transfer function is a pre-set function that matches the format of the call parameter, the entity object is pre-created in a native container, and the call parameter is an input parameter when calling the transfer function;

[0154] Receive native component data in a data provider of the native container callback; the data provider is a combination of native components in different pre-registered native systems.

[0155] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution can be essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.

[0156] Finally, it should be noted that the above embodiments are only used to illustrate the present invention, rather than to limit the present invention. Although the present invention is described in detail with reference to the embodiments, it should be understood by those skilled in the art that various combinations, modifications or equivalent substitutions of the technical solutions of the present invention do not depart from the spirit and scope of the technical solutions of the present invention, and should be included in the scope of the claims of the present invention.

Claims

1. A data sharing method, characterized in that: include: Injecting a transfer function into an entity object; the entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameter of the front-end interface; Receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters; The calling parameter is an input parameter when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems.

2. The data sharing method according to claim 1, characterized in that: The searching and calling back the native component data required by the front-end interface in the data provider according to the calling parameters includes: Parsing the calling parameters to obtain parsing results; Searching the data provider for a target native component that matches the parsing result; Creating a native component instance in the entity object according to the target native component; Passing the parameters of the native component instance into the target native function corresponding to the native component instance; The execution result data of the target native function is called back to the front-end interface.

3. The data sharing method according to claim 2, characterized in that: Before calling back the execution result data of the target native function to the front-end interface, the method includes: According to the target bridge identifier, searching for the execution result data of the target native function in the corresponding entity object; The target bridging identifier is a bridging identifier that is created in advance and is the same as the bridging identifier of the entity object.

4. The data sharing method according to claim 2, characterized in that: The calling back the execution result data of the target native function to the front-end interface includes: Using a preset callback function of the front-end interface, calling back the execution result data of the target native function to a preset receiving function of the front-end interface; The calling parameter includes an identifier of the preset callback function, and the identifier of the preset callback function corresponds to an identifier of the preset receiving function.

5. A data sharing method, characterized in that: include: Send calling parameters to the transfer function; The transfer function is pre-injected into the entity object, and the transfer function is a pre-set function that matches the format of the call parameter, the entity object is pre-created in the native container, and the call parameter is an input parameter when calling the transfer function; Receive native component data in a data provider of the native container callback; the data provider is a combination of native components in different pre-registered native systems.

6. The data sharing method according to claim 5, characterized in that: The receiving of the native component data in the data provider of the native container callback includes: Using a preset receiving function to receive the native component data in the data provider called back by a preset callback function from the native container; The calling parameter includes an identifier of the preset callback function, and the identifier of the preset callback function corresponds to an identifier of the preset receiving function.

7. A data sharing system, characterized in that: include: Native container and front-end interface; The native container is used to: Injecting a transfer function into an entity object; the entity object is created in advance, and the transfer function is a pre-set function that matches the format of the call parameter of the front-end interface; Receive the call parameters sent by the front-end interface, and search and call back the native component data required by the front-end interface in the data provider according to the call parameters; The calling parameter is an input parameter when the front-end interface calls the transfer function, and the data provider is a combination of pre-registered native components in different native systems; The front-end interface is used to: Send calling parameters to the transfer function; Receive the native component data in the data provider of the native container callback.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements the data sharing method according to any one of claims 1 to 4, or implements the data sharing method according to any one of claims 5 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the data sharing method as described in any one of claims 1 to 4, or implements the data sharing method as described in any one of claims 5 to 6.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, it implements the data sharing method according to any one of claims 1 to 4, or implements the data sharing method according to any one of claims 5 to 6.