Target function implementation method and device, electronic equipment and storage medium
By mapping front-end information and native methods through configuration files, the problem of increased workload in cross-end communication is solved, an efficient cross-end communication method is implemented, and the workload of electronic devices is reduced.
Patent Information
- Application Number
- CN202410309923.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2025-09-19
AI Technical Summary
In the existing technology, in cross-terminal communication on mobile terminals, each time a new native method that needs to be called by the front end is added, a JSB interface layer and adaptation code need to be added, which increases the workload of the electronic device.
Through the configuration file, the front-end information and native methods are mapped, the call request of the front-end page is obtained, the target native method is determined, and the parameter information is passed into the target native method to execute the function, reducing the workload of cross-end communication.
It reduces the workload of electronic devices in achieving cross-end communication, improves efficiency and flexibility, and reduces unnecessary code maintenance.
Smart Images

Figure CN120670056A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to computer technology, and more particularly to a method, apparatus, electronic device, and storage medium for implementing a target function. Background Art
[0002] During the development of electronic devices such as mobile devices, there are native frameworks associated with the operating system and front-end frameworks corresponding to the front-end pages. The two frameworks can exchange data and communicate in real time through cross-end communication.
[0003] At present, the cross-end communication method adopted by mobile terminals is based on JSB implementation. The front-end calls a native method in the native framework through the JSB interface layer and the JSB implementation layer. Among them, JSB, namely JSBridge, is a bridge for interaction between native and front-end JS (full name "JavaScript", a programming language).
[0004] The above method requires adding a corresponding JSB interface layer and JSB implementation layer each time the native method that the front end needs to call is a newly added method, and some adaptation codes need to be added, which increases unnecessary workload of the electronic device. Summary of the Invention
[0005] The present disclosure provides a method, device, electronic device and storage medium for implementing a target function, so as to reduce the workload of electronic devices when implementing cross-terminal communication.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for implementing a target function, including:
[0007] Obtaining a call request for a front-end page, the call request including target front-end information and target parameter information, the target front-end information including method information corresponding to the front-end page executing the target function;
[0008] Determine a target native method corresponding to the target front-end information according to a configuration file, wherein the target native method includes a method associated with an operating system;
[0009] Passing the target parameter information into the target native method to obtain the target implementation method;
[0010] Call the target implementation method to execute the corresponding target function.
[0011] In a second aspect, the embodiments of the present disclosure further provide a device for achieving a target function, including:
[0012] An acquisition module is used to acquire a call request of a front-end page, wherein the call request includes target front-end information and target parameter information, and the target front-end information includes method information corresponding to the target function executed by the front-end page;
[0013] a determination module, configured to determine a target native method corresponding to the target front-end information according to a configuration file, wherein the target native method includes a method associated with an operating system;
[0014] An input module is used to input the target parameter information into the target native method to obtain a target implementation method;
[0015] The calling module is used to call the target implementation method to execute the corresponding target function.
[0016] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0017] one or more processing devices;
[0018] a storage device for storing one or more programs,
[0019] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the target function implementation method provided by the embodiment of the present disclosure.
[0020] In a fourth aspect, an embodiment of the present disclosure further provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to execute the target function implementation method provided by the embodiment of the present disclosure.
[0021] The disclosed embodiments provide a method, device, electronic device and storage medium for realizing a target function, the method comprising: obtaining a call request of a front-end page, the call request comprising target front-end information and target parameter information, the target front-end information comprising method information corresponding to the front-end page executing the target function; determining a target native method corresponding to the target front-end information according to a configuration file, the target native method comprising a method associated with an operating system; passing the target parameter information into the target native method to obtain a target realization method; and calling the target realization method to execute the corresponding target function. The above technical solution, when the front-end needs to call the realization methods corresponding to different native methods to realize the corresponding functions, can determine the target native method corresponding to the target front-end information included in the call request through a configuration file, further realizing the call of the target realization method corresponding to the target native method to execute the corresponding function, which can reduce the workload of the electronic device when realizing cross-end communication. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
[0023] Figure 1 This is a flowchart of a method for achieving a target function provided by an embodiment of the present disclosure;
[0024] Figure 2 is a flowchart of another method for achieving a target function provided by an embodiment of the present disclosure;
[0025] Figure 3 This is a schematic diagram of communication between a front-end page and a native framework provided by an embodiment of the present disclosure;
[0026] Figure 4 This is a flow chart of a configuration file construction process provided by an embodiment of the present disclosure;
[0027] Figure 5 This is a schematic diagram of the structure of a device for achieving a target function provided by an embodiment of the present disclosure;
[0028] Figure 6 It is a structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0030] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0031] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0032] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0033] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0034] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0035] Figure 1 This is a flowchart of a method for implementing a target function provided by an embodiment of the present disclosure. This embodiment of the present disclosure is applicable to scenarios where cross-terminal communication between a native framework and a front-end framework is achieved. This method can be performed by a target function implementation device, which can be implemented in software and / or hardware and integrated into an electronic device. Optionally, the electronic device can be a mobile terminal, etc.
[0036] like Figure 1 As shown, the method includes:
[0037] S110. Obtain a call request for a front-end page, wherein the call request includes target front-end information and target parameter information, and the target front-end information includes method information corresponding to the front-end page executing a target function.
[0038] During the development process on the mobile side, there are native frameworks associated with the operating system and front-end frameworks corresponding to the front-end pages. The two frameworks can interact with each other and communicate in real time through cross-end communication. Among them, the native framework can be a development framework for a specific operating system (such as IOS). The native framework provides an application programming interface (API) and tools that are tightly integrated with the operating system, allowing developers to use the features and functions provided by the operating system to build native applications. The front-end framework can be a code library or a toolset that provides some preset structures, components, and functions to help developers build complex front-end pages more quickly. The native framework relies on the functions provided by the operating system to implement its functions, while the operating system provides developers with a more convenient and efficient development method through the native framework.
[0039] The front-end page can be the interface that users see and interact with when using an application or browsing a webpage, such as the layout, colors, text, images, etc. of the webpage. In one embodiment, the front-end page includes a front-end web page. The front-end web page can be the page displayed to the user through the front-end when browsing the web, such as an H5 (also known as the fifth generation Hypertext Markup Language (HTML)) page in an application.
[0040] The calling request of the front-end page may be a request for the front-end page to call a native method in the native framework to implement a corresponding function. In the native framework, a variety of native methods may be provided, and different functions may be implemented by calling different native methods by the front-end page. Among them, the native method may be a method in the native framework provided by the operating system. The native method may be directly associated with the core functions and application programming interface (Application Programming Interface, API) of the operating system. Through the call of the native method, the resources, data and other functions of the operating system may be directly accessed. The native method may also be a method that encapsulates methods associated with the operating system, such as a method provided by an application. The call of the native method can enable the application to implement the corresponding function, such as by calling the method for entering (or jumping to) the live broadcast room provided by the application providing the live broadcast service, the application can implement the function of entering (or jumping to) the live broadcast room. The target function may be the function that the front-end page needs to implement by calling the native method through a calling request.
[0041] The call request includes target front-end information, which can be front-end-related information required for the front-end page to perform the target function. The target front-end information includes method information corresponding to the front-end page's execution of the target function, which can be information related to the methods provided by the front-end page required for the front-end page to perform the target function.
[0042] In one embodiment, the front-end page can provide users with different services. Each service can include one or more methods. The different methods included in a service can be used to implement different functions corresponding to the service. For example, a camera service can include different methods such as opening the camera, taking a photo, and recording a video to implement the corresponding functions. If the target function is taking a photo, the method information corresponding to executing the target function may include the name of the method corresponding to taking a photo that the front-end can provide, and the name of the service to which the method belongs.
[0043] The call request includes target parameter information, which may be information about parameters required for the front-end page to execute the target function. For example, the target parameter information may include the name of the required parameter and the parameter value of the required parameter, which is not limited here.
[0044] There is no limitation on the method of obtaining the call request of the front-end page. For example, the front-end page may transmit the call request when the target function needs to be executed; or the electronic device may actively detect whether there is a call request of the front-end page, and the timing of the detection is not limited.
[0045] S120. Determine a target native method corresponding to the target front-end information according to a configuration file, where the target native method includes a method associated with an operating system.
[0046] The configuration file can be essentially understood as a file containing information required for successful program operation. In the embodiment of the present disclosure, the configuration file is used to provide a mapping relationship between front-end information and native methods. The mapping relationship can be a relationship indicating that the front-end information and the native methods correspond to each other.
[0047] Among them, the front-end information can be the front-end-related information required for the front-end page to execute a certain function. The front-end information includes the method information corresponding to the execution of a certain function. The method information corresponding to the execution of a certain function can include the name of the method corresponding to the function that the front-end can provide, and the name of the service to which the method belongs. The native method corresponding to the front-end information in the mapping relationship can be the native method corresponding to the function to be executed as indicated by the front-end information. Exemplarily, the front-end information includes the name of the method corresponding to taking pictures that the front-end can provide and the name of the service to which the method belongs. The native method corresponding to the front-end information can be the method corresponding to taking pictures provided by the native framework.
[0048] The configuration file can be defined by the native framework itself, and the corresponding front-end information is marked based on the native methods provided by the native framework. The specific technical means of marking are not limited here, as long as the corresponding native method can be uniquely determined through a certain front-end information.
[0049] The configuration file can also be a file dynamically issued by the server, such as a native framework that defines a configuration file and transmits it to the server, which then issues it dynamically. The server can also modify the mapping relationship between the front-end information and the native method in the configuration file as needed, as long as the corresponding native method can be uniquely determined through a certain front-end information. For example, for a certain front-end information, the corresponding native method may be method A, and the server can modify it to the native method B corresponding to the front-end information. After the modification, all clients that share the configuration file corresponding to the server can update the configuration file in real time through the server's issuance, which has stronger timeliness.
[0050] Therefore, in this step, the target native method that uniquely corresponds to the target front-end information can be determined based on the mapping relationship between the front-end information and the native method provided in the configuration file. The target native method can be the native method that the front-end page needs to call to execute the target function.
[0051] S130: Pass the target parameter information into the target native method to obtain a target implementation method.
[0052] The target implementation method may be a method corresponding to a target native method for executing a target function.
[0053] The target native method can be understood as an abstractly defined method. By passing the target parameter information into the target native method, the native method required to execute the target function can be combined with the parameter information required to execute the target function, and the target native method can be converted into a specific implementation, that is, the target implementation method.
[0054] In one embodiment, different target parameter information is combined with the same target native method, so that the obtained target implementation method can perform different operations to meet different needs.
[0055] S140: Call the target implementation method to execute the corresponding target function.
[0056] By calling the target implementation method corresponding to the target native method in the native framework, the corresponding target function is executed. The execution of the target function can be fed back to the user through the front-end page, allowing the user to experience the target function.
[0057] The disclosed embodiments provide a method, device, electronic device and storage medium for realizing a target function, the method comprising: obtaining a call request of a front-end page, the call request comprising target front-end information and target parameter information, the target front-end information comprising method information corresponding to the front-end page executing the target function; determining a target native method corresponding to the target front-end information according to a configuration file, the target native method comprising a method associated with an operating system; passing the target parameter information into the target native method to obtain a target realization method; and calling the target realization method to execute the corresponding target function. The above technical solution, when the front-end needs to call the realization methods corresponding to different native methods to realize the corresponding functions, can determine the target native method corresponding to the target front-end information included in the call request through a configuration file, further realizing the call of the target realization method corresponding to the target native method to execute the corresponding function, which can reduce the workload of the electronic device when realizing cross-end communication.
[0058] Based on the above embodiment, a modified embodiment of the above embodiment is proposed. It should be noted that, in order to simplify the description, only the differences from the above embodiment are described in the modified embodiment.
[0059] Figure 2 It is a flow chart of another method for realizing a target function provided by an embodiment of the present disclosure. The embodiment of the present disclosure is based on the above embodiment and further refines the target native method for determining the target front-end information corresponding to the configuration file.
[0060] In the embodiment of the present disclosure, the configuration file includes a mapping relationship between method information and native methods. The method information includes a service name and a method name under the service corresponding to the service name.
[0061] In the above embodiment, the configuration file is used to provide a mapping relationship between front-end information and native methods. Furthermore, the front-end information includes method information corresponding to executing a certain function, so the configuration file includes a mapping relationship between method information and native methods. The method information may include the name of the method corresponding to a certain function that the front-end can provide (i.e., method name), and the name of the service to which the method belongs (i.e., service name).
[0062] like Figure 2 As shown, the method includes:
[0063] S210. Obtain a call request for a front-end page, wherein the call request includes target front-end information and target parameter information. The target front-end information includes method information corresponding to the front-end page executing a target function.
[0064] S220. At a communication framework layer, based on the mapping relationship, determine a target native method corresponding to the target front-end information. The communication framework layer is a framework layer for implementing communication between the front-end page and the operating system.
[0065] S230: Pass the target parameter information into the target native method to obtain a target implementation method.
[0066] S240: Call the target implementation method to execute the corresponding target function.
[0067] Figure 3 This is a schematic diagram of a front-end page and a native framework communication provided by an embodiment of the present disclosure, that is, a schematic diagram of a front-end page and a native framework corresponding to an operating system communicating. Figure 3 As shown, when the front-end page needs to call and execute different functions, the corresponding call request is uniformly processed by the communication framework layer. Among them, the communication framework layer is integrated on the client and includes a configuration file and a dynamic forwarding module.
[0068] The dynamic forwarding module is used to determine the method information corresponding to the target function executed by the front-end page included in the target front-end information; in the mapping relationship between the method information provided by the configuration file and the native method, the native method corresponding to the method information included in the target front-end information is determined, that is, the target native method.
[0069] After determining the target native method, the target parameter information is passed to the target native method to obtain the target implementation method. The target implementation method is then implemented in the native framework to execute the corresponding target function. In other words, the dynamic forwarding module can use the language characteristics of the operating system to forward the front-end call to the corresponding native method to implement the target function.
[0070] In one embodiment, the configuration file construction operation includes:
[0071] Obtaining a function implementation code, wherein the function implementation code includes a code for implementing a corresponding function;
[0072] The configuration file is generated according to the function implementation code, wherein the function implementation code includes annotation information, and the annotation information includes front-end information corresponding to the function implemented by the function implementation code.
[0073] Function implementation code can be the code files involved in the interaction between the front-end page and the native framework. Function implementation code can be code used to implement a specific function, and a line within the code can indicate the native method used to implement the corresponding function. Function implementation code can include annotation information, which can be information that indicates the front-end information corresponding to the native method used by the function implementation code.
[0074] In actual applications, the function implementation code can be analyzed to determine the native method used to implement the corresponding function of the function implementation code and the front-end information in the annotation information, establish a mapping relationship between the determined native method and the front-end information, and further generate the corresponding configuration file.
[0075] In one embodiment, generating the configuration file according to the function implementation code includes:
[0076] Determining that the function implementation code includes annotation information for setting a annotation prefix;
[0077] Determining front-end information in the annotation information including setting the annotation prefix;
[0078] Determine the code of the code line corresponding to the setting annotation prefix as the native method of the function corresponding to the function implementation code;
[0079] Establishing a mapping relationship between the front-end information and the native method;
[0080] Add the mapping relationship to the configuration file.
[0081] The set annotation prefix may be a prefix used to indicate that the function implementation code includes annotation information, and the function implementation code including the set annotation prefix may be used to generate a configuration file.
[0082] In the function implementation code, annotation information can be placed on the code line where the annotation prefix is set. The line after the annotation prefix (i.e., the code line corresponding to the annotation prefix) can indicate the native method used to implement the corresponding function of the code. The front-end information included in the annotation information determined by the function implementation code and the native method determined by the function implementation code can be mapped to further generate the corresponding configuration file.
[0083] Optionally, in addition to the front-end information corresponding to the function implemented by the function implementation code, the annotation information may also include the names of parameters required to implement the function implemented by the function implementation code.
[0084] For example, when the function implemented by the function implementation code is the target function, the parameter values corresponding to the names are determined by the names of the parameters required to implement the target function included in the annotation information. Specifically, the parameters transmitted by the front-end page can be in the form of a dictionary. For each parameter, the parameter name and the parameter value corresponding to the name are a set. The corresponding parameter values can be determined by the names of the parameters required to implement the target function included in the annotation information, thereby determining the specific parameter values required for the front-end page to execute the target function.
[0085] Figure 4 This is a flow chart of a configuration file construction process provided by an embodiment of the present disclosure, such as Figure 4 As shown, the following steps are included:
[0086] For the function implementation code, determine whether it contains a set annotation prefix; if so, save the front-end information in the annotation information of the function implementation code; save the information of the native method indicated by the next line of code where the set annotation prefix is located; and generate a configuration file based on the saved front-end information and native method.
[0087] The technical solution of the disclosed embodiment is that when the front-end page needs to call to execute different functions, the corresponding call request can be uniformly processed by the communication framework layer. The configuration file in the communication framework layer cooperates with the dynamic call capability of the dynamic forwarding module to achieve cross-end communication, which can reduce the workload of electronic devices when achieving cross-end communication. In addition, when the configuration file is updated through dynamic distribution, the dynamic call module can forward the front-end call to the new native method based on the new mapping relationship in the updated configuration file, and the new call will not increase the size of the data packet.
[0088] Figure 5 This is a schematic diagram of the structure of a device for achieving a target function provided by an embodiment of the present disclosure. Figure 5 As shown, the device includes: an acquisition module 510, a determination module 520, an input module 530 and a calling module 540.
[0089] An acquisition module 510 is configured to acquire a call request of a front-end page, wherein the call request includes target front-end information and target parameter information, and the target front-end information includes method information corresponding to the target function executed by the front-end page;
[0090] A determination module 520 is configured to determine a target native method corresponding to the target front-end information according to a configuration file, wherein the target native method includes a method associated with an operating system;
[0091] The input module 530 is used to input the target parameter information into the target native method to obtain the target implementation method;
[0092] The calling module 540 is used to call the target implementation method to execute the corresponding target function.
[0093] The technical solution provided by the embodiment of the present disclosure is to obtain the call request of the front-end page through the acquisition module, the call request includes target front-end information and target parameter information, the target front-end information includes the method information corresponding to the target function executed by the front-end page; determine the target native method corresponding to the target front-end information according to the configuration file through the determination module, the target native method includes the method associated with the operating system; pass the target parameter information to the target native method through the input module to obtain the target implementation method; call the target implementation method through the calling module to execute the corresponding target function. The above technical solution, when the front end needs to call the implementation method corresponding to different native methods to realize the corresponding function, can determine the target native method corresponding to the target front-end information included in the call request through the configuration file, and further realize the call of the target implementation method corresponding to the target native method to execute the corresponding function, which can reduce the workload of electronic devices when realizing cross-end communication.
[0094] In one embodiment, the configuration file includes a mapping relationship between method information and native methods, and the determination module 520 is specifically configured to:
[0095] At the communication framework layer, based on the mapping relationship, a target native method corresponding to the target front-end information is determined. The communication framework layer is a framework layer for realizing communication between the front-end page and the operating system.
[0096] In one embodiment, the method information includes a service name and a method name under the service corresponding to the service name.
[0097] In one embodiment, the apparatus further comprises a building block for:
[0098] Obtaining a function implementation code, wherein the function implementation code includes a code for implementing a corresponding function;
[0099] The configuration file is generated according to the function implementation code, wherein the function implementation code includes annotation information, and the annotation information includes front-end information corresponding to the function implemented by the function implementation code.
[0100] In one embodiment, the building module is specifically configured to:
[0101] Determining that the function implementation code includes annotation information for setting a annotation prefix;
[0102] Determining front-end information in the annotation information including setting the annotation prefix;
[0103] Determine the code of the code line corresponding to the setting annotation prefix as the native method of the function corresponding to the function implementation code;
[0104] Establishing a mapping relationship between the front-end information and the native method;
[0105] Add the mapping relationship to the configuration file.
[0106] In one embodiment, the configuration file is a file dynamically sent by the server.
[0107] In one embodiment, the front-end page includes a front-end web page.
[0108] The target function implementation device provided by the embodiment of the present disclosure can execute the target function implementation method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0109] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0110] Figure 6 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 6 , which shows an electronic device (eg Figure 6 A structural diagram of a terminal device or server) 500.
[0111] An electronic device provided in an embodiment of the present disclosure includes:
[0112] one or more processing devices;
[0113] a storage device for storing one or more programs,
[0114] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the target function implementation method provided by any embodiment of the present disclosure.
[0115] The terminal devices in the embodiments of the present disclosure may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., as well as fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0116] like Figure 6 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the electronic device 500 are also stored in the RAM 503. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An edit / output (I / O) interface 505 is also connected to the bus 504.
[0117] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0118] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0119] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0120] The electronic device provided by the embodiment of the present disclosure and the target function implementation method provided by the above embodiment belong to the same inventive concept. For technical details not fully described in this embodiment, please refer to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0121] An embodiment of the present disclosure provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the target function implementation method provided by the above embodiment is implemented.
[0122] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
[0123] The computer storage medium may be a storage medium of computer-executable instructions, which, when executed by a computer processor, are used to perform the methods provided in the present disclosure.
[0124] Computer-readable storage media may include, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, device, or component. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wire, optical cable, RF (radio frequency), etc., or any suitable combination thereof.
[0125] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0126] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0127] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains a calling request of the front-end page, the calling request includes target front-end information and target parameter information, the target front-end information includes method information corresponding to the front-end page executing the target function; determines the target native method corresponding to the target front-end information according to the configuration file, the target native method includes a method associated with the operating system; passes the target parameter information into the target native method to obtain a target implementation method; and calls the target implementation method to execute the corresponding target function.
[0128] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0129] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0130] The modules or units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a module or unit does not, in some cases, limit the unit itself.
[0131] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0132] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0133] According to one or more embodiments of the present disclosure, Example 1 provides a method for implementing a target function, including:
[0134] Obtaining a call request for a front-end page, the call request including target front-end information and target parameter information, the target front-end information including method information corresponding to the front-end page executing the target function;
[0135] Determine a target native method corresponding to the target front-end information according to a configuration file, wherein the target native method includes a method associated with an operating system;
[0136] Passing the target parameter information into the target native method to obtain the target implementation method;
[0137] Call the target implementation method to execute the corresponding target function.
[0138] According to one or more embodiments of the present disclosure, Example 2 is the method according to Example 1,
[0139] The configuration file includes a mapping relationship between method information and native methods, and determining a target native method corresponding to the target front-end information according to the configuration file includes:
[0140] At the communication framework layer, based on the mapping relationship, a target native method corresponding to the target front-end information is determined. The communication framework layer is a framework layer for realizing communication between the front-end page and the operating system.
[0141] According to one or more embodiments of the present disclosure, Example 3 is the method according to Example 2,
[0142] The method information includes a service name and a method name under the service corresponding to the service name.
[0143] According to one or more embodiments of the present disclosure, Example 4 is the method according to Example 1,
[0144] The configuration file construction operation includes:
[0145] Obtaining a function implementation code, wherein the function implementation code includes a code for implementing a corresponding function;
[0146] The configuration file is generated according to the function implementation code, wherein the function implementation code includes annotation information, and the annotation information includes front-end information corresponding to the function implemented by the function implementation code.
[0147] According to one or more embodiments of the present disclosure, Example 5 is the method according to Example 4,
[0148] Generating the configuration file according to the function implementation code includes:
[0149] Determining that the function implementation code includes annotation information for setting a annotation prefix;
[0150] Determining front-end information in the annotation information including setting the annotation prefix;
[0151] Determine the code of the code line corresponding to the setting annotation prefix as the native method of the function corresponding to the function implementation code;
[0152] Establishing a mapping relationship between the front-end information and the native method;
[0153] Add the mapping relationship to the configuration file.
[0154] According to one or more embodiments of the present disclosure, Example 6, according to the method of Example 1,
[0155] The configuration file is a file dynamically sent by the server.
[0156] According to one or more embodiments of the present disclosure, Example 7, according to the method of Example 1,
[0157] The front-end page includes a front-end network page.
[0158] According to one or more embodiments of the present disclosure, Example 8 provides a target function implementation device, including:
[0159] An acquisition module is used to acquire a call request of a front-end page, wherein the call request includes target front-end information and target parameter information, and the target front-end information includes method information corresponding to the target function executed by the front-end page;
[0160] a determination module, configured to determine a target native method corresponding to the target front-end information according to a configuration file, wherein the target native method includes a method associated with an operating system;
[0161] An input module is used to input the target parameter information into the target native method to obtain a target implementation method;
[0162] The calling module is used to call the target implementation method to execute the corresponding target function.
[0163] According to one or more embodiments of the present disclosure, Example 9 provides an electronic device, the electronic device including:
[0164] one or more processing devices;
[0165] a storage device for storing one or more programs,
[0166] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the target function implementation method as described in any one of Examples 1-7.
[0167] According to one or more embodiments of the present disclosure, Example 10 provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the target function implementation method as described in any one of Examples 1-7.
[0168] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0169] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0170] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A method for achieving a target function, characterized in that: include: Obtaining a call request for a front-end page, the call request including target front-end information and target parameter information, the target front-end information including method information corresponding to the front-end page executing the target function; Determine a target native method corresponding to the target front-end information according to a configuration file, wherein the target native method includes a method associated with an operating system; Passing the target parameter information into the target native method to obtain the target implementation method; Call the target implementation method to execute the corresponding target function.
2. The method according to claim 1, characterized in that The configuration file includes a mapping relationship between method information and native methods, and determining a target native method corresponding to the target front-end information according to the configuration file includes: At the communication framework layer, based on the mapping relationship, a target native method corresponding to the target front-end information is determined. The communication framework layer is a framework layer for realizing communication between the front-end page and the operating system.
3. The method according to claim 2, characterized in that The method information includes a service name and a method name under the service corresponding to the service name.
4. The method according to claim 1, wherein The configuration file construction operation includes: Obtaining a function implementation code, wherein the function implementation code includes a code for implementing a corresponding function; The configuration file is generated according to the function implementation code, wherein the function implementation code includes annotation information, and the annotation information includes front-end information corresponding to the function implemented by the function implementation code.
5. The method according to claim 4, characterized in that Generating the configuration file according to the function implementation code includes: Determining that the function implementation code includes annotation information for setting a annotation prefix; Determining front-end information in the annotation information including setting the annotation prefix; Determine the code of the code line corresponding to the setting annotation prefix as the native method of the function corresponding to the function implementation code; Establishing a mapping relationship between the front-end information and the native method; Add the mapping relationship to the configuration file.
6. The method according to claim 1, characterized in that The configuration file is a file dynamically sent by the server.
7. The method according to claim 1, characterized in that The front-end page includes a front-end network page.
8. A target function realization device, characterized in that: include: An acquisition module is used to acquire a call request of a front-end page, wherein the call request includes target front-end information and target parameter information, and the target front-end information includes method information corresponding to the target function executed by the front-end page; a determination module, configured to determine a target native method corresponding to the target front-end information according to a configuration file, wherein the target native method includes a method associated with an operating system; An input module is used to input the target parameter information into the target native method to obtain a target implementation method; The calling module is used to call the target implementation method to execute the corresponding target function.
9. An electronic device, characterized in that: The electronic device comprises: one or more processing devices; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the target function implementation method as described in any one of claims 1 to 7.
10. A storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to perform the target function implementation method according to any one of claims 1 to 7.