Data sharing method and device, electronic equipment and storage medium

By setting a sharing environment in the main application and defining data sharing rules, the problems of data type limitations and function loss in cross-site data sharing are solved, and more efficient and convenient data sharing is achieved.

CN119848007AInactive Publication Date: 2025-04-18SHENZHEN MINIPLAY TECH CO LTD

Patent Information

Application Number
CN202510296897.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-04-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art has problems with data type limitations and loss of functions in cross-site data sharing scenarios, especially when object data conversion and sub-applications actively acquire data.

Method used

By setting the sharing environment of the main application and defining data sharing rules, the main application manages the global state of the shared data and allows sub-apps to read and update shared data according to the rules.

Benefits of technology

It simplifies data interaction between the main application and the sub-app, reduces data type limitations, and improves the convenience and effectiveness of cross-site data sharing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848007A_ABST
    Figure CN119848007A_ABST
Patent Text Reader

Abstract

The invention provides a data sharing method and device, electronic equipment and a storage medium. The data sharing method comprises the following steps: setting a sharing environment of a main application, wherein the sharing environment is used for initializing a global state of the main application for managing shared data; defining a data sharing rule set by the main application based on the sharing environment, wherein the data sharing rule is used for defining an operation mode of reading and updating the shared data by the sub-application; receiving a data updating request initiated by the sub-application to the main application according to the data sharing rule; and after the main application receives a data updating request of the sub-application, performing data updating based on the data sharing rule. The data sharing method and device are used for improving the convenience degree of data sharing in a cross-site scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data sharing method, device, electronic device and storage medium. Background Art

[0002] In front-end development, embedding external interfaces is a common requirement, mainly used to integrate third-party content, services or functions, including social media plug-ins, online maps, video playback, advertising and marketing content, and some independent templates. In the prior art, query parameters are dynamically added to the URL of the current page through JavaScript, and the interaction of complex data is completed through the postMessage mechanism. In the data sharing scenario, the PostMessage mechanism can only synchronize strings, and a conversion operation is required for object type data. Reverse conversion is also required when receiving data. During the conversion process, function type data contained in the data will be lost, increasing data costs. Sub-applications cannot actively obtain data from the main application through the PostMessage mechanism.

[0003] In summary, the existing technology has many limitations in data sharing scenarios, which is not conducive to cross-site data sharing scenarios. Summary of the invention

[0004] One purpose of the present application is to propose a data sharing method, device, electronic device and storage medium to improve the convenience of data sharing in cross-site scenarios.

[0005] According to one aspect of an embodiment of the present application, a data sharing method is provided, including: Setting a shared environment of the main application, wherein the shared environment is used to initialize a global state of the main application managing shared data; Defining data sharing rules established by the main application based on the sharing environment, wherein the data sharing rules are used to define the operation mode of the sub-application to read and update the shared data; receiving a data update request initiated by the sub-application to the main application according to the data sharing rule; After the main application receives the data update request of the sub-application, the main application updates the data based on the data sharing rule.

[0006] According to one aspect of an embodiment of the present application, a data sharing device is provided, including: An environment initialization module, used to set a shared environment for the main application, wherein the shared environment is used to initialize the global state of the main application managing shared data; A sharing rule setting module, used to define the data sharing rules established by the main application based on the sharing environment, wherein the data sharing rules are used to define the operation mode of the sub-application to read and update the shared data; A data update request module, configured to receive a data update request initiated by the sub-application to the main application according to the data sharing rule; The data update operation module is used to update the data based on the data sharing rule after the main application receives the data update request of the sub-application.

[0007] According to one aspect of an embodiment of the present application, there is provided an electronic device, including: One or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the electronic device implements the methods provided in the above-mentioned various optional implementations.

[0008] According to one aspect of an embodiment of the present application, a computer program medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the methods provided in the above-mentioned various optional implementations.

[0009] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above various optional implementations.

[0010] In an embodiment of the present application, a shared environment of the main application is set, and the global state of the main application managing shared data is initialized based on the shared environment; data sharing rules established by the main application based on the shared environment are defined, and the data sharing rules are used to define the operation mode of the sub-application to read and update the shared data; a data update request initiated by the sub-application to the main application according to the data sharing rules is received, and after the main application receives the data update request of the sub-application, the data is updated based on the data sharing rules. This embodiment sets a shared environment for the main application and sets data sharing rules based on the shared environment, so that data can be shared between the main application and the sub-application. By setting a shared environment, on the one hand, it can simplify the interaction mode between the main application and the sub-application for shared data, and on the other hand, it can reduce the restrictions on the data type of data sharing in the shared environment, which can improve the convenience and sharing effect of data sharing in cross-site scenarios to a certain extent.

[0011] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0012] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and other objects, features and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.

[0014] Figure 1 A schematic flow chart of the data sharing method provided in this embodiment is shown.

[0015] Figure 2 A schematic diagram of the process of data sharing between the main application and the sub-application is shown.

[0016] Figure 3 A schematic diagram of the structure of the data sharing device provided in this embodiment is shown.

[0017] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0018] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that the description of the present application will be more comprehensive and complete and the concepts of the example embodiments will be fully conveyed to those skilled in the art. The accompanying drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.

[0019] In addition, the described features, structures or characteristics may be combined in one or more example embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the example embodiments of the present application. However, those skilled in the art will appreciate that the technical solution of the present application may be practiced while omitting one or more of the specific details, or other methods, components, steps, etc. may be adopted. In other cases, known structures, methods, implementations or operations are not shown or described in detail to avoid obscuring the present application and making the various aspects of the present application obscure.

[0020] Some of the blocks shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0021] Cross-site data sharing mechanism refers to a method of sharing data between web pages or applications from different sources (different domain names, protocols or ports).

[0022] PostMessage (window messaging) is a cross-window, cross-iframe, and cross-tab communication method provided by HTML5, which is suitable for data sharing between front-end pages. Page A sends data to page B through the PostMessage function. Page B monitors the event and verifies the legitimacy of the event source to ensure data security.

[0023] This communication method is not restricted by the same-origin policy and can share data across domains. Object-type data requires a conversion operation, and reverse conversion is required when receiving, which increases the operation cost. During the conversion process, function-type data contained in the data will be lost. In addition, the sub-application cannot actively obtain the data of the main application through PostMessage, which limits the use of cross-site sharing to a certain extent, resulting in poor data sharing results.

[0024] Figure 1 FIG. 2 shows a flow chart of the data sharing method provided in this embodiment. Figure 1 As shown, the method comprises the following steps: S100, setting a shared environment of the main application, where the shared environment is used to initialize the global state of the main application managing shared data.

[0025] Specifically, the main application referred to in this embodiment is responsible for managing the overall architecture, and can be a parent page, a container application, or a main site. The main application provides functions such as shared data, global state management, and user identity authentication, and loads multiple sub-applications through an iframe framework.

[0026] As an independent front-end application, the sub-application is usually managed by the main application and needs to share data, user status, etc. with the main application, and data security and independence must be guaranteed.

[0027] Since the main application and the sub-application may be in different domains, they need to communicate using a cross-site data sharing mechanism.

[0028] Setting up a shared environment for the main application means using the global state of the main application as a shared storage space. The shared storage space allows the main application to share data with sub-applications and manage sub-applications globally with the global state. When a sub-application needs to update data, the data is updated synchronously according to the global management function of the main application.

[0029] S200, defining data sharing rules established by the main application based on the sharing environment, where the data sharing rules are used to define the operation mode of the sub-application to read and update the shared data.

[0030] Specifically, after the global state of the main application is set, the global state of the main application is received through the storage engine, and the global state of the main application is set as a responsive object, so that data sharing rules can be established based on the shared environment.

[0031] Data sharing rules define how the shared data of the main application is subscribed by the sub-application, and how the sub-application triggers the main application to update the data.

[0032] The method by which the main application's shared data is subscribed by the sub-application corresponds to the sub-application's method of reading the shared data; how the sub-application triggers the main application's operation of updating data corresponds to the sub-application's method of updating the shared data.

[0033] The storage engine may be Unistore, etc. By defining the main application, the global state of the main application is set as a responsive object to quickly synchronize shared data between the main application and the sub-application.

[0034] S300, receiving a data update request initiated by a sub-application to a main application according to a data sharing rule.

[0035] Specifically, the sub-application initiates a data update request to the main application according to the data sharing rules, and after receiving the data update request from the sub-application, the main application updates the field data requested to be updated by the sub-application according to the data update operation mode defined in the data sharing rules.

[0036] As an optional implementation, before the sub-application initiates a data update request to the main application, the sub-application needs to subscribe to the required field data in the shared data, and the main application needs to collect all the field data subscribed by the sub-applications and obtain the subscription status of each field data. The subscription status represents the sub-application's dependence on the field data.

[0037] S400, after the main application receives the data update request from the sub-application, the main application updates the data based on the data sharing rules.

[0038] After receiving the data update request from the sub-application, the main application obtains the target field data that needs to be updated by the sub-application and the update method for the target field data from the data update request, and then updates the target field data according to the update method.

[0039] After the update is completed, the main application determines the sub-applications that subscribe to the target field data based on the subscription status of the target field data, and sends update notifications of the update status of the target field data to these sub-applications. The sub-applications that receive the update notifications update the target field data to which they belong.

[0040] In this embodiment, by setting the shared environment of the main application, the global state of the shared data of the main application is initialized based on the shared environment, the data sharing rules are mounted under the main application based on the shared environment, and the management of the shared data by the main application and the way of reading and updating the shared data by the sub-application are defined according to the data sharing rules; the data update request initiated by the sub-application to the main application according to the data sharing rules is received, and after the main application receives the data update request of the sub-application, the target field data is updated based on the data sharing rules, and an update notification is sent to the subscriber who subscribes to the target field data according to the subscription status of the target field data. On the one hand, it can simplify the interaction method between the main application and the sub-application on the shared data, and on the other hand, it can reduce the restrictions on the data type of data sharing in the shared environment, thereby improving the data sharing effect in the cross-site data sharing scenario to a certain extent.

[0041] Further, S100, setting a shared environment of the main application includes: S110, determining that the current operating environment complies with a preset operating framework, where the preset operating framework is used to define a shared environment of the main application.

[0042] S120, defining the global state of the main application based on the preset running framework, where the global state is used to define the interaction mode of shared data between the main application and the sub-application.

[0043] Specifically, in the scenario of cross-site data sharing, it is necessary to distinguish whether the code's running environment is in the main application (top-level window) or the sub-application (iframe). This method ensures that the sub-application accesses the shared environment created and managed by the main application. If the running environment of the current page is the top-level page, it means that the current window is the main application. If the running environment of the current page is in the sub-application, the shared environment of the main application is accessed through the interface.

[0044] The preset running framework is a global environment based on the main interface defined by Unistore, which enables sub-applications to generate their own running windows with the help of the iframe mechanism, but can access the shared environment created by the main application to ensure data synchronization.

[0045] Further, S200, defining data sharing rules established by the main application based on the sharing environment, including: S210, update the global status of the main application.

[0046] S220, based on the global state, a global response method is mounted under the main application, the global response method defines data sharing rules, and the sub-application operates on the shared data by accessing the interface set by the global response method.

[0047] Specifically, a data access interface corresponding to the global response method is mounted under the main application, and the sub-application performs read operations and update operations on the shared data by accessing the data interface.

[0048] After initializing the global state of the main application through the preset running framework, the global response method defines the data sharing rules, sets different data access interfaces according to the type of data sharing rules, and the sub-applications access, read and update the shared data through the data access interfaces.

[0049] As an optional implementation, the global response method includes a field subscription function, S220, mounting the global response method under the main application based on the global state, including: S2211, obtaining the field subscription function of the sub-application to the shared data, where the field subscription function is used to define the sub-application's reference to the field data in the shared data.

[0050] Specifically, the field subscription function defines the rules for sub-applications to reference field data, allowing sub-applications to subscribe to field data in shared data.

[0051] As an optional implementation, the global response method includes a dependency update function, S220, mounting the global response method under the main application based on the global state, including: S2221, collect the reference status of each field data in the shared data, set the dependent update function according to the reference status, and the dependent update function is used to send an update notification to the subscriber of the field data when the field data is updated.

[0052] Specifically, by collecting the reference status of each field data in the shared data, the sub-application references the field data according to the reference status, and these sub-applications are used as subscribers of a certain field data.

[0053] When a field data is updated, the dependent update function sends an update notification to the subscriber of the field data after the field data is updated.

[0054] As an optional implementation, a global state management tool is used to manage the shared environment of the main application. The callback refers to the callback function passed by the main application to the global state management tool, which is used to notify the subscribers related to the change when the shared data changes. The subscriber is the sub-application that references the field data in the shared data. When these field data change, the main application sends a change notification to the sub-applications.

[0055] Specifically, when the dependent update function is called, it means that the field data is updated. At this time, the callback function is called to pass in the latest field data when the field data is updated and send a notification to the subscriber.

[0056] The global state management tool can be used to initialize the shared environment of the main application, adjust the main application to a responsive object, and mount the global response method under the main application to automatically update the shared data when it is updated.

[0057] Further, S300, receiving a data update request initiated by the sub-application to the main application according to the data sharing rule, includes: S310, obtaining a data access request established by the sub-application based on the data sharing rule, where the data access request is used to update the target field data.

[0058] S320: Based on the data update request, update the target field data.

[0059] Specifically, according to the data access request established by the sub-application based on the data sharing rule, the target field data and the update value of the target field data are defined in the data access request.

[0060] The target field data refers to the field data that the sub-application wants to update, and the update value of the target field data is the field value after the target field data is updated.

[0061] Further, S400, after the main application receives the data update request of the sub-application, the main application updates the data based on the data sharing rule, including: S410, obtaining a data update method for the target field data of the sub-application, and updating the target field data according to the data update method.

[0062] S420, triggering the data callback function, and sending a data update notification to the subscriber of the target field data according to the subscription status of the target field data.

[0063] The main application modifies the target field data according to the data update method defined in the data update request initiated by the sub-application.

[0064] The data update method refers to the updated value of the target field data.

[0065] During the modification process, the main application calls the callback function to trigger the callbacks of all subscribers. The sub-applications that have subscribed to the target field data will automatically receive update notifications for the target field data.

[0066] In this process, the sub-application triggers the main application's changes to the shared data by relying on the update function. When the main application modifies the shared data, the callback function triggers the callback of the field subscription function to send the changes to the shared data to the sub-application. The sub-application adjusts the field value of the field data referenced by the update notification, thereby quickly achieving global synchronization of the shared data.

[0067] Figure 2 A schematic diagram of the process of data sharing between the main application and the sub-application is shown.

[0068] like Figure 2 As shown, the shared environment is obtained by initializing the global state of the main application by the global state management tool, and the main application and the sub-application share and synchronize shared data based on the shared environment.

[0069] After initializing the global state of the main application, mount the global response method under the main application.

[0070] Global response methods include filedSubscrible and filedMutation. filedSubscrible is a field subscription function that allows sub-applications to call this method to obtain shared data. This method is packaged through setter. filedMutation is a dependent update function that allows sub-applications to call this method to update the value of the target field data in the shared data. This method is packaged through getter, and the getter also includes the initialization operation of the shared environment of the main application. The main application obtains the data update operation of the target field data in the shared environment, and then triggers the callback function while modifying the target field data to send an update notification to the sub-application.

[0071] The global state of the main application can be initialized by a global state management tool. As an optional implementation, the global state management tool can be Unistore, which is used to share the global state (store) of the main application between the main application (top window) and the sub-application (iframe), and automatically notify all subscribers when the shared data changes.

[0072] Dependency collection means that the shared environment obtains the sub-application's reference to the field data according to the getter method. When the field data changes, the callback function is called to send the change notification to the sub-application that has subscribed to the field data, i.e., the subscriber, to synchronize the field data.

[0073] Figure 3 FIG. 2 shows a schematic diagram of the structure of the data sharing device provided in this embodiment. Figure 3 As shown, the data sharing device includes: The environment initialization module 31 is used to set the shared environment of the main application, and the shared environment is used to initialize the global state of the main application managing shared data.

[0074] The sharing rule setting module 32 is used to define the data sharing rules set up by the main application based on the sharing environment. The data sharing rules are used to define the operation mode of the sub-application to read and update the shared data.

[0075] The data update request module 33 is used to receive a data update request initiated by a sub-application to a main application according to a data sharing rule.

[0076] The data update operation module 34 is used to update the data based on the data sharing rule after the main application receives the data update request of the sub-application.

[0077] Furthermore, the environment initialization module 31 is configured as follows: Determine that the current operating environment complies with a preset operating framework, which is used to define a shared environment for the main application.

[0078] The global state of the main application is defined based on the preset running framework. The global state is used to define how shared data interacts between the main application and sub-applications.

[0079] Furthermore, the sharing rule setting module 32 is configured to: Update the main application's global state.

[0080] Based on the global state, a global response method is mounted under the main application. The global response method defines data sharing rules. The sub-application operates on the shared data by accessing the interface set by the global response method.

[0081] As an optional implementation, the sharing rule setting module 32 is configured to: The global response method includes field subscription functions.

[0082] Get the field subscription function of the sub-application to the shared data. The field subscription function is used to define the sub-application's reference to the field data in the shared data.

[0083] As an optional implementation, the sharing rule setting module 32 is configured to: The global response method includes dependency update functions.

[0084] Collect the reference status of each field data in the shared data, set the dependent update function according to the reference status, and the dependent update function is used to send an update notification to the subscriber of the field data when the field data is updated.

[0085] Furthermore, the data update request module 33 is configured as follows: Get the data access request established by the sub-application based on the data sharing rules. The data access request is used to update the target field data.

[0086] Based on the data update request, the target field data is updated.

[0087] Furthermore, the data update operation module 34 is configured as follows: Get the data update method of the sub-application for the target field data, and update the target field data according to the data update method.

[0088] The data callback function is triggered to send data update notifications to the subscribers of the target field data according to the subscription status of the target field data.

[0089] Figure 4 The schematic diagram of the structure of the electronic device provided by this embodiment is shown below. Figure 4 The electronic device 50 provided in this embodiment is described. Figure 4 The electronic device 50 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0090] like Figure 4 As shown, the electronic device 50 is in the form of a general computing device. The components of the electronic device 50 may include but are not limited to: at least one processing unit 510, at least one storage unit 520, and a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510).

[0091] The storage unit stores program codes, which can be executed by the processing unit 510, so that the processing unit 510 executes the steps according to various exemplary embodiments of the present application described in the description of the exemplary method described above in this specification. For example, the processing unit 510 can execute the following steps: Figure 1 The steps shown in .

[0092] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 5201 and / or a cache storage unit 5202 , and may further include a read-only storage unit (ROM) 5203 .

[0093] The storage unit 520 may also include a program / utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0094] Bus 530 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0095] The electronic device 50 may also communicate with one or more external devices 600 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 50, and / or communicate with any device that enables the electronic device 50 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 550. The input / output (I / O) interface 550 is connected to a display unit 540. In addition, the electronic device 50 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 560. As shown, the network adapter 560 communicates with other modules of the electronic device 50 via a bus 530. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0096] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software, or by combining software with necessary hardware. Therefore, the technical solution according to the implementation method of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a mobile terminal, etc.) to execute the data sharing method according to the implementation method of the present application.

[0097] In an exemplary embodiment of the present application, a computer-readable storage medium is further provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the data sharing method described in the above method embodiment.

[0098] According to one embodiment of the present application, a program product for implementing the method in the above method embodiment is also provided, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0099] The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable 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 thereof.

[0100] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0101] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0102] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages, such as JAVA, C++, etc., and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0103] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units. In addition, although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0104] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation method of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a mobile terminal, etc.) to execute the method according to the implementation method of the present application.

[0105] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the appended claims.

Claims

1. A data sharing method, characterized in that: include: Setting a shared environment of the main application, wherein the shared environment is used to initialize a global state of the main application managing shared data; defining a data sharing rule established by the main application based on the shared environment, wherein the data sharing rule is used to define an operation mode in which the sub-application reads and updates the shared data; receiving a data update request initiated by the sub-application to the main application according to the data sharing rule; After the main application receives the data update request of the sub-application, the main application updates the data based on the data sharing rule.

2. The data sharing method according to claim 1, characterized in that: The setting of the shared environment of the main application includes: Determining that the current operating environment complies with a preset operating framework, wherein the preset operating framework is used to define a shared environment for a main application; The global state of the main application is defined based on the preset running framework, and the global state is used to define the interaction mode of the shared data between the main application and the sub-application.

3. The data sharing method according to claim 1, characterized in that: The defining of the data sharing rules established by the main application based on the sharing environment includes: Updating the global state of the main application; A global response method is mounted under the main application based on the global state, the global response method defines a data sharing rule, and the sub-application operates on the shared data by accessing an interface set by the global response method.

4. The data sharing method according to claim 3, characterized in that: The global response method includes a field subscription function, and the global response method is mounted under the main application based on the global state, including: A field subscription function of the sub-application to the shared data is obtained, where the field subscription function is used to define a reference situation of the sub-application to the field data in the shared data.

5. The data sharing method according to claim 4, characterized in that: The global response method includes a dependency update function, and the global response method is mounted under the main application based on the global state, including: The reference status of each field data in the shared data is collected, and a dependent update function is set according to the reference status, wherein the dependent update function is used to send an update notification to a subscriber of the field data when the field data is updated.

6. The data sharing method according to claim 1, characterized in that: The receiving a data update request initiated by the sub-application to the main application according to the data sharing rule includes: Obtaining a data access request established by the sub-application based on the data sharing rule, wherein the data access request is used to update target field data; Based on the data update request, an update operation is performed on the target field data.

7. The data sharing method according to claim 1, characterized in that: After the main application receives the data update request of the sub-application, updating the data based on the data sharing rule includes: Acquire a data update method of the sub-application for target field data, and update the target field data according to the data update method; The data callback function is triggered to send a data update notification to the subscriber of the target field data according to the subscription status of the target field data.

8. A data sharing device, characterized in that: The device comprises: An environment initialization module, used to set a shared environment for the main application, wherein the shared environment is used to initialize the global state of the main application managing shared data; A sharing rule setting module, used to define the data sharing rules established by the main application based on the sharing environment, wherein the data sharing rules are used to define the operation mode of the sub-application to read and update the shared data; A data update request module, configured to receive a data update request initiated by the sub-application to the main application according to the data sharing rule; The data update operation module is used to update the data based on the data sharing rule after the main application receives the data update request of the sub-application.

9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the electronic device to implement the data sharing method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the data sharing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for dynamically loading master and sub applications based on micro-front-end architecture

    CN115827105A

  • Resource sharing method, micro-front-end system, application and computer readable storage medium

    CN115842733A

  • Method and system for realizing micro-front-end architecture, storage medium, equipment and terminal

    CN117675781A

Cited By

  • Cross-application data response type sharing method and device based on Qiankun micro front end

    CN122309198A