Application compatible operation method and device and storage medium
By leveraging the synergy of the multi-container management module and the JS service module, the compatibility issues of H5 applications across different containers are resolved, enabling cross-platform dynamic response and adaptive adjustment, and reducing development and maintenance costs.
Patent Information
- Application Number
- CN202511108560.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-11-07
AI Technical Summary
Existing H5 applications suffer from poor compatibility across different WebView containers, communication protocols, and rendering engines, resulting in high development and maintenance costs and making it impossible to achieve "develop once, run on multiple platforms".
By applying a compatible runtime method, the multi-container management module and the JS service module negotiate and specify the runtime container, intercept and transform call requests, and achieve cross-platform dynamic response and adaptive adjustment.
It enables H5 applications to run compatiblely on different containers, reduces development and maintenance costs, and ensures cross-platform compatibility and adaptability.
Smart Images

Figure CN120909704A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of IT research and development, and particularly relates to an application compatible running method, device and storage medium. BACKGROUND
[0002] In the tide of rapid iteration of information technology, cross-platform development has become the core engine driving application innovation. Hypertext Markup Language 5 (H5) applications have shown a flourishing development trend due to their flexibility in cross-terminal adaptation and advantages in development efficiency. For enterprises, in order to meet the diversified business scenarios and terminal requirements, multiple hybrid development App platforms are gradually built. These platforms are based on different technical architectures and implementation logic, supporting the digital operation of various businesses.
[0003] However, the multiple hybrid development platforms within a company use different WebView containers, communication protocols and rendering engines, resulting in compatibility differences between H5 applications and failing to achieve the goal of "one development, multiple running". This technical fragmentation not only increases development and maintenance costs, but also hinders the standardization evolution and cross-platform reuse of H5 applications. SUMMARY
[0004] The purpose of the present application is to provide an application compatible running method, device and storage medium, aiming to realize the compatible running of applications on different containers.
[0005] In a first aspect, the present application provides an application compatible running method applied to an application compatible running system, including a multi-container management module of a front end and a JS service module of a back end; the method includes: after a user logs in the application compatible running system, the multi-container management module initializes multiple running containers configured in the hybrid management application compatible running system; after the user selects a first H5 application, the multi-container management module negotiates a specified running container of the first H5 application with the JS service module; during the running of the H5 application, the JS service module intercepts a first calling request of the first H5 application according to the mapping rule of the specified running container, sends a second calling request to the multi-container management module; the format of the first calling request conforms to the JSAPI specified format of the native container of the first H5 application; the format of the second calling request conforms to the JSAPI specified format of the specified running container; the multi-container management module sends the second calling request to the specified running container based on the specified running container, obtains a response result generated by the specified running container; and the response result is converted to conform to the specified format of the native container and sent to the first H5 application.
[0006] The application provides an application compatible running method, which is applied to an application compatible running system and includes a multi-container management module at the front end and a JS service module at the back end. The method includes the following steps: after a user logs in the application compatible running system, the multi-container management module initializes multiple running containers configured in the application compatible running system; after the user selects a first H5 application, the multi-container management module negotiates a designated running container of the first H5 application with the JS service module; during the running of the H5 application, the JS service module intercepts a first calling request of the first H5 application according to a mapping rule of the designated running container, and sends a second calling request to the multi-container management module; the multi-container management module sends the second calling request to the designated running container based on the designated running container, and obtains a response result generated by the designated running container; and the response result is converted into a format conforming to a regulation of a native container and is sent to the first H5 application. It can be seen that, through the joint action of the H5 application between the multi-container management module and the JS service module and under the mapping rule, the method realizes dynamic response of the H5 application, ensures adaptive adjustment of the H5 application to match a new architecture, and thus solves the compatibility problem and realizes compatible running of the application on different containers.
[0007] In combination with the first aspect, the multi-container management module and the JS service module negotiate the designated running container of the first H5 application, including that the multi-container management module obtains a parameter list of the first H5 application; determines the designated running container from a target field of the parameter list; and writes a container type of the designated running container into a user-agent string, so that the JS service module determines the designated running container according to the user-agent string.
[0008] In combination with the first aspect, the system further includes an H5 distribution module at the back end; and the method further includes that the multi-container management module sends an identity of the user to the H5 distribution module; the H5 distribution module determines a parameter list of multiple H5 applications that the user has the right to use according to the identity, and sends the parameter list of the multiple H5 applications to the multi-container management.
[0009] In combination with the first aspect, the method further includes that the multi-container management module loads a mapping rule of the designated running container according to the designated running container.
[0010] In combination with the first aspect, during the running of the first H5 application, if the first H5 application calls a function of a second H5 application, a third calling request of the first H5 application is intercepted, and a fourth calling request is sent to the second H5 application; the first calling request conforms to an internal calling specification of the first H5 application; and the second calling request conforms to an internal calling specification of the second H5 application.
[0011] In combination with the first aspect, the third call request of the first H5 application is intercepted, the fourth call request is sent to the second H5 application, and the method comprises the following steps: screening the class name of the third call request to obtain the first method name; determining the second method name of the same function from the maintained mapping table according to the first method name, and splicing the second method name with the class name of the second H5 application to obtain the fourth call request; and sending the fourth call request to the second H5 application.
[0012] In combination with the first aspect, the application compatible running method further comprises: performing format conversion on the transmission parameter, so that the format of the transmission parameter meets the requirements of the second H5 application; and the transmission parameter is a parameter transmitted in the call request when the first H5 application calls the function of the second H5 application.
[0013] In combination with the first aspect, the application compatible running method further comprises: after receiving the response result of the second H5 application, converting the response result into a format meeting the internal call specification of the first H5 application, and sending the response result to the first H5 application.
[0014] In the second aspect, the present application provides an electronic device, comprising: a processor and a memory; the memory stores instructions executable by the processor; and the processor is configured to execute the instructions, so that the electronic device implements the method of the first aspect.
[0015] In the third aspect, the present application provides a computer readable storage medium, comprising: computer software instructions; when the computer software instructions run in an electronic device, the electronic device implements the method of the first aspect.
[0016] The beneficial effects of the second aspect to the third aspect can be referred to the corresponding description of the first aspect, and will not be described again. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0018] Figure 1 A schematic diagram of an application compatible running system is provided for the embodiments of the present application;
[0019] Figure 2 A flowchart of an application compatible running method is provided for the embodiments of the present application;
[0020] Figure 3 A dynamic configuration processing framework of a multi-container management module is provided for the embodiments of the present application;
[0021] Figure 4 A method for application compatible running provided in an embodiment of the present application;
[0022] Figure 5 Another method for application compatible running provided in an embodiment of the present application;
[0023] Figure 6 A structure diagram of an application compatible running device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0025] It should be noted that, in the embodiments of the present application, the words such as "exemplarily" or "for example" are used to represent as an example, illustration or description. Any embodiment or design scheme described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. In fact, the words such as "exemplarily" or "for example" are intended to present the related concept in a specific manner.
[0026] In the embodiments of the present application, the terms "first", "second", "third", "fourth", "fifth", "sixth" are only used for description purpose, and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features limited by "first", "second", "third", "fourth", "fifth", "sixth" can explicitly or implicitly include one or more of the features.
[0027] In the embodiments of the present application, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes the elements inherent to such process, method, article or device. Without more limitation, the element limited by the sentence "including a…" does not exclude the existence of another same element in the process, method, article or device including the element.
[0028] As described in the above background, with the rapid evolution of information technology, cross-platform H5 application development has seen explosive growth, and multiple sets of mixed development APP platforms and H5 applications adapted to multiple architectures have been formed within enterprises. However, current H5 applications face multiple compatibility bottlenecks in actual operation, which are as follows: cross-application adaptation barriers, the exposed open capabilities of different enterprise internal APPs differ significantly, making it difficult for H5 applications to achieve "one build, multiple platforms seamless deployment" - an H5 application under a certain mixed development architecture often cannot directly compatible with the running environment of other internal APPs; container upgrade adaptation failure, when the original container of the APP is upgraded, the existing H5 application lacks a dynamic response mechanism and cannot adaptively adjust to match the new architecture, thereby causing compatibility problems; container replacement adaptation obstacles, if the APP container environment needs to be replaced due to business demand changes, the existing H5 application also cannot dynamically adapt to the architecture characteristics of the new container, resulting in frequent adaptation failures.
[0029] Based on the above problems, the application provides an application compatible running method, applied to an application compatible running system, including a multi-container management module in the front end and a JS service module in the back end; the method includes: after a user logs in the application compatible running system, the multi-container management module initializes multiple running containers configured in the application compatible running system; after the user selects a first H5 application, the multi-container management module negotiates a specified running container of the first H5 application with the JS service module; during the running of the H5 application, the JS service module intercepts a first call request of the first H5 application according to the mapping rule of the specified running container, sends a second call request to the multi-container management module; the format of the first call request conforms to the JS API specified format of the original container of the first H5 application; the format of the second call request conforms to the JS API specified format of the specified running container; the multi-container management module sends the second call request to the specified running container based on the specified running container, obtains a response result generated by the specified running container; and converts the response result to conform to the specified format of the original container and sends it to the first H5 application. As can be seen, this method realizes dynamic response of the H5 application through the joint action of the H5 application between the multi-container management module and the JS service module and under the mapping rule, ensures adaptive adjustment of the H5 application to match the new architecture, and thus solves the compatibility problem.
[0030] Figure 1 An application compatible running system schematic diagram provided by the embodiments of the application is shown in FIG. 1. Figure 1 As shown in the figure, the application compatible running system includes a multi-container management module 101 in the front end, a JS service module 102 in the back end, and an H5 distribution module 103 in the back end.
[0031] H5 application refers to an application program developed based on modern web technologies such as HTML5, CSS3, JavaScript, and the like, and is usually run in a browser or a WebView environment of a mobile terminal. Unlike a native application (Native App), the H5 application does not need to be installed and can be accessed through a webpage, and has the characteristics of cross-platform, low development cost, and fast iteration speed.
[0032] The multi-container management module 101 of the front end refers to a module integrated based on a native container or framework and a plurality of native JSBridge containers or frameworks, and is responsible for encapsulation and mutual conversion mapping of open capability jsAPI and modification control of a user agent (User Agent, UA) identifier. The native JSBridge container includes a third-party container such as Cordova and EMAS. Cordova is an open-source cross-platform mobile application development framework that allows H5 applications to be built using HTML5, CSS3, and JavaScript, provides a cordova.js dependency, and accesses native device functions such as a camera, a global positioning system (GPS), and storage through cordova.js. The Cordova container is a platform-specific native environment for running Cordova applications. EMAS is a commercial cross-platform mobile application development framework developed by Alibaba, and provides a windwave.js dependency for H5 applications. The EMAS container is a platform-specific native environment for running EMAS applications.
[0033] The JS service module 102 of the back end is responsible for encapsulation of abstract capabilities of common.js, and realizes dynamic compatible adaptation of JS dependencies, JSAPI, and JSAPI calling modes across containers and APPs. The common.js is a JavaScript file, JS refers to JavaScript, which is a scripting programming language mainly used for web development, and JSAPI is a JavaScript-based application programming interface.
[0034] The H5 distribution module 103 of the back end is responsible for distribution of H5 application packages, version management, and manifest parameters, and the H5 application package covers H5 of different jsBridge running environments such as emasH5 and cordovaH5. The version management identifies different iterations through semantic version numbers or timestamps, and realizes dynamic upgrading by means of HTTP caching, offline package incremental updating, or CDN multi-version coexistence, and needs to be matched with a monitoring and quick rollback mechanism to ensure stability. The manifest parameters include information such as module identifier, introduction, version explanation, version number, and specified container type.
[0035] The application compatible running method provided by the embodiment of the application is that after a user logs in an application compatible running system, a plurality of hybrid containers integrated by a front-end multi-container management module 101 perform initialization operations, wherein the front-end multi-container management module 101 sends an identity of the user to a back-end H5 distribution module 102, each H5 application has its own corresponding manifest parameter, the user determines the parameter manifest corresponding to a plurality of H5 applications that the user has access rights to according to the identity, and sends the parameter manifest to the user, after the user selects a first H5 application, the front-end multi-container management module 101 negotiates a designated running container of the first H5 application with the back-end JS service module 102, in the running process of the H5 application, the back-end JS service module 102 intercepts a first call request of the first H5 application according to a mapping rule of the designated running container, the front-end multi-container management module 101 sends a second call request, the front-end multi-container management module 101 sends the received second call request to the designated running container, and finally obtains a response result generated by the designated running container, converts the response result into a format specified by a native container, and sends the response result to the first H5 application. The modules are processed in layers and smoothly connected with each other, so that the processing logic of the compatibility problem is clearer.
[0036] The application compatible running method provided by the embodiment of the application will be described in detail below in combination with specific embodiments and the accompanying drawings of the specification:
[0037] Figure 2 A flowchart of an application compatible running method provided by the embodiment of the application. The method is applied to the application compatible running system shown in the figure, and specifically includes the following steps S201-S205: Figure 1
[0038] S201, after a user logs in an application compatible running system, a multi-container management module initializes a plurality of running containers configured in the application compatible running system.
[0039] The initialization refers to a process of setting an initial state or preparing necessary resources for a system, a component or a variable before program running. The purpose is to ensure that subsequent operations can be executed in a correct environment.
[0040] In a possible implementation manner, after the user logs in the application compatible running system, the multi-container management module first initializes the plurality of running containers, performs initialization operations such as obtaining applications that can have access rights and selecting a running environment, and prepares for subsequent compatibility, wherein selecting different running environments means selecting different containers.
[0041] For example, after the user logs in the APP client successfully, the multi-container management module initializes all integrated H5 containers JSBridge frameworks, then requests the user to have access rights to H5 applications, and obtains a set of usable H5 applications.
[0042] In some embodiments, the system further comprises an H5 distribution module of the backend, and the method further comprises: the multi-container management module sending the identity of the user to the H5 distribution module; the H5 distribution module determining, according to the identity, a parameter list of a plurality of H5 applications to which the user has access, and sending the parameter list of the plurality of H5 applications to the multi-container management.
[0043] After the user logs in the system and initializes the container or framework, the user then requests an H5 application to which the user has access, i.e., the multi-container management module sends the identity of the user to the H5 distribution module, each H5 application has its own corresponding list parameter, and the user determines, according to the identity, a parameter list corresponding to a plurality of H5 applications to which the user has access, the parameters in the parameter list are dynamically configured, and in particular, the container can be configured, and then the parameter list is sent to the multi-container management, which provides a key role for the application compatible running system to solve the compatibility of different containers of H5 applications.
[0044] For example, a parameter list of a meeting assistant H5 application of an office automation system in a company, which includes the identifier of the module, the brief introduction is that the conference room can be booked, the conference can be initiated on the palm, the participants can be quickly notified, and the meeting notice and seat map can be viewed, the release note is that the meeting assistant, the version number is 0.0.941, the search keyword can be used for quick access, and other functions are included, and the parameter list includes a specified container type. The data structure of the cubeJson parameter list is defined as follows:
[0045] {
[0046] "identifier":"com.csair.oa.meetingAssistant", / / Module identifier
[0047] "description":"Book a conference room, initiate a conference on the palm, quickly notify participants, view meeting notices and seat maps",
[0048] "releaseNote":"Meeting Assistant", / / Release note
[0049] "version":"0.0.941", / / Version number
[0050] "keyWord":"Sign in / Book / Conference Room / Materials / Enrollment", / / Search keyword
[0051] "enableWatermark":false, / / Whether to add a security watermark
[0052] "build":941, / / Build number
[0053] "comeFrome":"emas" / / specified container type
[0054] }
[0055] For example, after the user logs in the APP client and initializes all integrated H5 container JSBridge frameworks, the user's permissions are determined to determine the available H5 application set, and these H5 applications include emasH5 and cordovaH5 business applications. However, the current requirement is that the emasH5 business application wants to run under the Cordova third-party container, and the compatibility problem can be solved by running the application compatible system. Among them, EMASH5 refers to an H5 page running in an EMAS framework or container, and EMAS will provide a dedicated jsBridge. Because the first H5 application corresponds to a native third-party framework and a selected specified running container, there is a compatibility problem.
[0056] In one possible implementation, the specified container is determined by dynamically configuring the cubeJson manifest parameter.
[0057] For example, if the emasH5 business application wants to run under the cordova JSBridge environment, the container can be specified by configuring the comeFrome field in the cubejson manifest parameter, such as modifying "comeFrome":"emas" to "comeFrome":"cordova".
[0058] Figure 3 A multi-container management application dynamic configuration processing framework provided by the embodiment of the application is shown in the figure. In the absence of introducing a new container or replacing the container, H5 application A and H5 application B will run according to their respective processes, such as Figure 3 The figure shows the H5 application running process based on the unified mobile architecture APP, and H5 application A and H5 application B determine their respective CubeJson specified containers through API calls and commonJS dependencies. Application A corresponds to the Cordova container, and application B corresponds to the Windwave container. In the unified mobile architecture underlying layer, commonJS dependencies connect Cordova dependencies, Windwave dependencies, and DSBridge dependencies to realize the running logic of different H5 applications under the support of corresponding containers and underlying dependencies. For example Figure 3As shown in the lower edge of the figure, in the case of introducing a new container or replacing a container, the H5 application A and the H5 application B both determine the specified container according to the respective CubeJson through API calling and commonJS dependency, the specified container of the H5 application A in the figure will be mapped to the Windwave container, realizing the replacement container operation, and the specified container of the H5 application B will be mapped to the DWKwebview container, realizing the replacement of the newly entered container operation. Similarly, in the unified mobile architecture underlying layer, the commonJS dependency connects the Cordova dependency, the Windwave dependency and the DSBridge dependency, realizing the running logic of different H5 applications under the support of corresponding containers and underlying dependencies, and through the application layered processing, the connection between the containers and the dependencies, the compatibility logic is clearly realized, so that different H5 applications adapt to the unified architecture and run efficiently under the corresponding container and dependency system.
[0059] S202, after the user selects the first H5 application, the multi-container management module and the JS service module negotiate the specified running container of the first H5 application.
[0060] The first H5 application refers to a business application selected by the user from the H5 applications with access permission.
[0061] The specified running container of the first H5 application refers to the container determined by the multi-container management module and the JS service module, such as the Emas container, the Cordova container, etc.
[0062] In one possible implementation manner, after the user logs in the application compatible running system, the user available H5 application set is determined according to the user permission, the user selects an available H5 application as the first H5 application, clicks the first H5 application entrance, and then the specified running container of the first H5 application is negotiated through the multi-container management module and the JS service module.
[0063] In some embodiments, the multi-container management module and the JS service module negotiate the specified running container of the first H5 application, including: the multi-container management module obtains the parameter list of the first H5 application; the specified running container is determined from the target field of the parameter list; and the container type of the specified running container is written into the user-agent string, so that the JS service module determines the specified running container according to the user-agent string.
[0064] The user-agent string refers to the user agent string, which is part of the HTTP request header, and is used to identify the type, version, operating system and other information of the client software (such as browser, application program, etc.) initiating the request.
[0065] In a possible implementation, a user selects a first H5 application with cubeJson parameter manifest content, the multi-container management module parses the parameter manifest content of the first H5 application, a specified running container is obtained according to a key field, the type of the specified running container is written into a user-agent string, the specified running container is determined for subsequent JS service module parsing and judgment, and finally H5 application resources including html, js, css and the like are loaded through the determined specified running container.
[0066] For example, the first H5 application has cubeJson parameter manifest content, and the container type in the H5 distribution module has been changed, for example, an emasH5 business application wants to run in a cordova JSBridge environment, "comeFrome":"emas" is modified to "comeFrome":"cordova", the type of the specified running container is cordova, which is written into the user-agent string, the specified running container is determined for subsequent JS service module parsing and judgment, and finally H5 application resources are loaded through the determined specified running container.
[0067] For example, the specified running container has been written into the user-agent string, and the user-agent data is as follows:
[0068] UA:Mozilla / 5.0(Linux;Android 13;PDHM00 Build / TP1A.220905.001;wv)AppleWebKit / 537.36(KHTML,like Gecko)Version / 4.0Chrome / 103.0.5060.129MobileSafari / 537.36;ecloudApp_android_3.7.27;Cordova_3.3.0;language_zh-cn;loginType_app;physicalDeviceType_phone.
[0069] Cordova_3.3.0 represents the type and version of the specified container, and ecloudApp_android_3.7.27 represents the type and version of the app client.
[0070] S203、In the H5 application running process, the JS service module intercepts a first call request of the first H5 application according to a mapping rule of the specified running container, and sends a second call request to the multi-container management module.
[0071] The format of the first calling request conforms to a JS API specified format of the native container of the first H5 application; and the format of the second calling request conforms to a JS API specified format of the specified running container.
[0072] The mapping rule refers to a mapping rule of the JS API of the native container to the JS API of the specified container. The mapping is a corresponding relationship established between two things, which is converting one operation, format or specification to another at a functional level, that is, the JS API calling of the native container and the JS API of the specified container can be converted to each other, which can ensure compatibility. The mapping rule is generated in the multi-container management module.
[0073] In some embodiments, the multi-container management module loads the mapping rule of the specified running container according to the specified running container.
[0074] The mapping rule refers to a mapping rule of the JS API of the native container to the JS API of the specified container. The mapping rule is generated in the multi-container management, which is beneficial to the compatibility of different containers.
[0075] The format specification of the calling request includes a unified method name, a calling manner, a naming style of parameters, a data type, a format requirement, a required item and a value boundary, a fixed metadata of a request header and an extended field format, etc., to ensure consistency in the above aspects, so as to ensure consistency, security and reliability of the calling.
[0076] In a possible implementation, during the running of the H5 application, based on the mapping rule of the JS API of the native container to the JS API of the specified container, the JS service module intercepts the JS API of the native container of the first H5 application, the format of the first calling request conforms to the JS API specified format of the native container of the first H5 application, the JS API of the native container of the first H5 application is converted into the JS API of the specified container, the JS API specified format of the specified running container conforms to the format of the second calling request, and the JS API of the specified running container is sent to the multi-container management module.
[0077] The JS service module of the backend determines the specified container type and the client type according to the user-agent string information injected by the container, loads the dependencies of the specified running container, and maps the calling specification of the intercepted native container JS API to the calling specification of the JS API of the specified running container, and forwards the JS API of the specified running container to the multi-container module.
[0078] S204, the multi-container management module sends a second calling request to the specified running container based on the specified running container, and obtains a response result generated by the specified running container.
[0079] For example, the multi-container management module obtains the JS API for specifying a running container through step S203, forwards the JS API for specifying a running container to the specified running container for processing, and obtains a response result in the specified container JS API specification format after processing.
[0080] S205, converting the response result into a format conforming to the native container specification, and sending the response result to the first H5 application.
[0081] In a possible implementation, after receiving the second invocation request, the multi-container management module obtains a response result generated by the specified running container, then finds a mapping relationship between the JS API of the native container and the JS API of the specified running container through the container type specified in the cubJson manifest parameter, converts the processed response result in the specified running container JS API specification format into a response result in the native container JS API specification format, and returns the response result to the H5 application to support subsequent business processing.
[0082] According to the above steps S201-S205, the application provides a specific embodiment of an application compatible running method, as shown in Figure 4 Figure 4 An application compatible running method schematic diagram is provided for the embodiments of the present application. A user starts to log in, and a multi-container management module of a front end initializes a cordova, an emaS and other third-party JSBridge libraries. A back end H5 distribution module distributes a cordova H5 application, an emaS H5 application and the like which are used by the user legally. The user selects a specific H5 application and clicks an entrance of the specific H5 application in the distributed H5 application. In the multi-container management module of the front end, a cubeJSon list of the H5 application is parsed to determine a running container type, and a running container identifier is written to a UA. An H5 resource is loaded through a native specified container, the H5 application is initialized and run, commonJS dependencies are loaded, and in a commonJS service module of the back end, UA information is checked to determine a running environment such as a client type and a container type. Corresponding specified container bridging dependencies are loaded, and a calling method specification is converted to a method adapted to the specified container bridging dependencies. In the H5 application module, a commonJS jsAPI is called. In the multi-container management module of the front end, a JSAPI (a mapping relationship between the commonJS api and each container JSAPI) to be mapped is determined according to the container type specified in the cubejson list. In the H5 application module, a native response is given to a calling result of the corresponding JSAPI. The user can view H5 business, and the application compatible running process ends. The method performs hierarchical processing on each module and realizes smooth communication between the modules. The processing logic of the compatibility problem is clearer. The mapping relationship enables the open capability JS API calling to be reusable without modification. Moreover, the H5 development process realizes one-time development and multi-environment running compatibility.
[0083] The embodiments described below can be executed in the multi-container management module or the JS service module.
[0084] In one embodiment, during the running of a first H5 application, if the first H5 application calls a function of a second H5 application, a third calling request of the first H5 application is intercepted, and a fourth calling request is sent to the second H5 application. The third calling request conforms to a first H5 application internal calling specification, and the fourth calling request conforms to a second H5 application internal calling specification.
[0085] Exemplary, the first H5 application is a user-selected H5 application on a third-party app, which intends to call the function of a certain H5 application of the company's internal app, and the second H5 application refers to the H5 application on the internal app to be called by the third-party app. Due to the problems of code specification, inconsistent interfaces, etc. between different apps, the third-party app will intercept the calling request of the third-party app, and according to the mapping table, the third-party app calling specification is mapped to the company internal app calling specification. Among them, the first H5 application refers to the third-party app, and the mapping of the third-party app calling request to the company internal app calling request is called the fourth calling request, which can be sent to the company internal app for request operation.
[0086] In some embodiments, intercepting the third calling request of the first H5 application, sending the fourth calling request to the second H5 application, includes: shielding the class name of the third calling request to obtain the first method name; determining the second method name of the same function from the maintained mapping table according to the first method name, and splicing the second method name with the class name of the second H5 application to obtain the fourth calling request; sending the fourth calling request to the second H5 application.
[0087] Exemplary, the process of obtaining the fourth calling request also includes: shielding the class name of the calling request of the third-party app, which is a unified class name (for example, Ehome), for which the first method name is determined, and the first method name includes multiple according to the function implementation, and the second method name of the same function is determined from the maintained mapping table according to the first method name. The second method name refers to the implementation class name of the function provided by the third-party APP, which is spliced with the class name of the company internal app through the implementation class determined by the mapping table, so that the fourth calling request can be obtained. Among them, the mapping relationship corresponding to the mapping table is the mapping relationship between the method name of the first H5 application and the implementation class of the same function.
[0088] Exemplary, the class name passed by the first H5 application is unified as A, and the function of the second H5 application is divided based on the class name, and A class name is not included, so a mapping table, i.e. a method mapping table, needs to be constructed. For example, according to the method names b1, c1, d1 provided by the class name A, find the implementation class names B1, C1, D1 that want to provide the function, and construct the mapping table according to the method name and the class name. Because the class names are the same, the implementation classes B, C, D of the second H5 application can be determined directly, and the implementation class name found by the first H5 application is spliced with the class name of the second H5 application to obtain the fourth request.
[0089] For example, the implementation class and method name mapping code of the first H5 application is as follows:
[0090]
[0091] The mapping table is used to locate the actual class name; finally, the function of the second H5 application is called through the actual class name, and the method execution is completed. The compatibility of the class name A passed by the first H5 application is realized, and the function of the second H5 application is fully reused.
[0092] In some embodiments, the method further comprises: format conversion of the passing parameter, so that the format of the passing parameter conforms to the requirements of the second H5 application; the passing parameter is the parameter in the calling request when the first H5 application calls the function of the second H5 application.
[0093] In a possible implementation, the first H5 application call specification is converted to conform to the second H5 application call specification, at which time the first H5 specification call request converted to conform to the first H5 application call specification can be sent to the second H5 application for processing.
[0094] For example, the parameters of part of the call interface need to be converted, because the parameter format passed by the first H5 application is inconsistent with the logic of the second H5 application. In order to ensure that the existing logic of the second H5 application is not affected, the parameters passed by the first H5 application need to be adapted and converted to a format that conforms to the requirements of the internal App.
[0095] For example, through this parameter modification method, seamless connection with ehome-common.js can be realized without modifying the existing logic of the internal App, and the example code is as follows:
[0096]
[0097]
[0098] In some embodiments, the method further comprises: after receiving the response result of the second H5 application, converting the response result to conform to the internal call specification of the first H5 application, and sending it to the first H5 application.
[0099] In a possible implementation, the second H5 application returns the result after processing the request, which needs to be converted to conform to the internal specification format of the first H5 application and displayed to the user.
[0100] For example, because the first H5 application calls the second H5 application, the returned result needs to be consistent with the structure required by the first H5 application after the call interface is completed, in order to meet the compatibility of different applications corresponding to the H5 application.
[0101] For example, after the API execution is complete, the returned result may not conform to the structure required by ehome-common.js. Therefore, it is necessary to adapt and convert the result, adjusting the returned result of the internal app to conform to the structure of ehome-common.js to ensure compatibility with heterogeneous H5 applications. Example code is as follows:
[0102]
[0103] The following will provide a detailed description of the process for the first H5 application to call the function of the second H5 application, along with a specific embodiment and accompanying drawings.
[0104] Figure 5 This is a schematic diagram of another application-compatible operation method provided in the embodiments of this application, such as... Figure 5 As shown, Figure 5 The application contains an internal APP module and a third-party APP module, both of which have their own H5 applications. Normally, for the internal APP module, when not called by the third-party APP, the process is as follows: the JavaScript file `ecloud-common.js` calls the native code using various class names, such as `userInterface`, `deviceUtil`, `network`, `mediaHelper`, and `fileHelper`. The corresponding API logic is executed based on the class name, and the result is returned directly after execution. However, the embodiment provided in this application involves the H5 application in the third-party APP module calling the H5 application in the internal APP module. The specific process is as follows: the H5 application in the third-party APP module uses the JavaScript file `ehome-common.js` to call the native code of the internal APP module using the class name `Ehome`. First, it checks if it is `Ehome`. If it is, it finds the corresponding class name through a mapping table based on the method name and handles parameter conversion. After processing, it executes the corresponding API logic based on the class name. After execution, it checks again if it is `Ehome`. If it is `Ehome`, it constructs a data structure consistent with the original `Ehome` based on the result and sends the callback result to the API for display through the third-party app; otherwise, it sends the callback result to the API for display through the internal app. The above steps, through mapping tables, parameter conversion, and result transformation, achieve compatibility with Ehome and fully reuse the existing functions of the internal App.
[0105] The application solves the problem of one-time development of H5 research and development process in the internal app, and realizes the ecological unity of business application by developing a multi-container management module, without modifying the JS API calling method for adaptation, realizing the full reuse of the existing functions of the internal app by the H5 of the third-party app, converting the input parameters of the third-party app into the format required by the internal app, realizing seamless connection of the code, and adjusting the format of the returned result of the H5 to the format required by the third-party app, meeting the compatibility of heterogeneous app H5.
[0106] The application also provides an electronic device, which can be the application compatible running device in the method embodiment. Figure 6 A structural schematic diagram of an application compatible running device provided by the application embodiment is shown in the figure. Figure 6 The device can include a processor 601 and a memory 602, the memory 602 stores instructions executable by the processor 601, and the processor 601 is configured to execute the instructions to enable the electronic device or network device or manager to implement the method described in the foregoing method embodiment.
[0107] The application provides a computer readable storage medium, which includes computer software instructions, and when the computer software instructions run in an electronic device, the electronic device implements the method described above. The computer can be an electronic device or a network device or a manager. The computer readable storage medium can be a non-transitory computer readable storage medium, for example, a non-transitory computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk and an optical data storage device, etc.
[0108] In the description of the embodiments of the application, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0109] The above is only a specific implementation of the application, but the protection scope of the application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the application, which should be covered within the protection scope of the application. Therefore, the protection scope of the application should be subject to the protection scope of the claims.
Claims
1. An application compatible running method, characterized in that, The application is applied to an application compatible running system, including a front-end multi-container management module and a back-end JS service module; the method comprises: After a user logs in the application compatible running system, the multi-container management module initializes multiple running containers configured in the application compatible running system; After the user selects a first H5 application, the multi-container management module negotiates with the JS service module to determine a designated running container of the first H5 application; During running of the H5 application, the JS service module intercepts a first calling request of the first H5 application according to a mapping rule of the designated running container, and sends a second calling request to the multi-container management module; the first calling request is in a format conforming to a JS API regulation format of a native container of the first H5 application; the second calling request is in a format conforming to a JS API regulation format of the designated running container; The multi-container management module sends the second calling request to the designated running container based on the designated running container, and obtains a response result generated by the designated running container; The response result is converted into a format conforming to a regulation format of the native container, and is sent to the first H5 application.
2. The method of claim 1, wherein, The multi-container management module and the JS service module negotiate the designated running container of the first H5 application, which comprises: The multi-container management module obtains a parameter list of the first H5 application; The designated running container is determined from a target field of the parameter list; A container type of the designated running container is written into a user-agent string, so that the JS service module determines the designated running container according to the user-agent string.
3. The method of claim 2, wherein, The system further comprises a back-end H5 distribution module; the method further comprises: The multi-container management module sends an identity of the user to the H5 distribution module; The H5 distribution module determines a parameter list of multiple H5 applications that the user has the right to use according to the identity, and sends the parameter list of the multiple H5 applications to the multi-container management.
4. The method of claim 2, wherein, The method further comprises: The multi-container management module loads a mapping rule of the designated running container according to the designated running container.
5. The method of claim 1, wherein, During running of the first H5 application, if the first H5 application calls a function of a second H5 application, a third calling request of the first H5 is intercepted, and a fourth calling request is sent to the second H5 application; The third calling request conforms to an internal calling specification of the first H5 application; The fourth calling request conforms to an internal calling specification of the second H5 application.
6. The method of claim 5, wherein, The intercepting of the third calling request of the first H5 and the sending of the fourth calling request to the second H5 application comprise: A class name of the third calling request is shielded to obtain a first method name; A second method name of the same function is determined from a maintained mapping table according to the first method name, and the second method name is spliced with a class name of the second H5 application to obtain the fourth calling request; The fourth calling request is sent to the second H5 application.
7. The method of claim 6, wherein, The method further comprises: format conversion is performed on the passing parameter so that the format of the passing parameter meets the requirement of the second H5 application; the passing parameter is a parameter passed in a calling request when the first H5 application calls a function of the second H5 application.
8. The method of claim 5, wherein, The method further comprises: After receiving the response result of the second H5 application, the response result is converted to meet the internal calling specification of the first H5 application and is sent to the first H5 application.
9. An electronic device, comprising: The controller comprises a processor and a memory; The memory stores instructions executable by the processor; The processor is configured to execute the instructions, so that the controller implements the method according to any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium comprises computer software instructions; When the computer software instructions are run in an electronic device, the electronic device implements the method according to any one of claims 1-8.