Data management methods, devices, electronic equipment and storage media

By initializing the IndexedDB database and creating a communication link in the browser window, the problem of data management and sharing among multiple browser windows is solved, and unified data management and retention are achieved.

CN116126962BActive Publication Date: 2026-05-2658 CHANG LIFE (BEIJING) INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
58 CHANG LIFE (BEIJING) INFORMATION TECH CO LTD
Filing Date
2022-12-22
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing single-page data state management tools cannot achieve unified data management for multiple browser windows, and iframe communication based on postMessage cannot achieve data communication and sharing between multiple browser windows and cannot retain data.

Method used

By initializing N browser windows, using the IndexedDB database to store data and creating communication links, data sharing and retention are achieved between browser windows of the same origin, and BroadcastChannel is used for data synchronization between windows.

Benefits of technology

It achieves unified data management and data sharing across multiple browser windows, solves the problem of data communication and sharing between windows, and retains data through the IndexedDB database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116126962B_ABST
    Figure CN116126962B_ABST
Patent Text Reader

Abstract

This application provides a data management method, apparatus, electronic device, and storage medium. The data management method includes: initializing N browser windows to cache target data from a target storage table into a first variable in each browser window; creating communication links between the N browser windows, where N is greater than or equal to 2; the target storage table is a storage table in the IndexedDB database corresponding to the browser; and the target data is an object structure including data keys and data values. When the target browser window triggers an update of the target data value corresponding to the target data key in the target storage table, the content in the first variable corresponding to the N browser windows is updated. When the array set includes the target data key, an update is triggered in the browser window corresponding to the target data key. This application can achieve unified data management across multiple browser windows, updating the corresponding browser window based on changes in the target data value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data management method, apparatus, electronic device and storage medium. Background Technology

[0002] Currently, when managing data in a browser window, it can be done using single-page data state management tools such as Vuex (a state management pattern specifically developed for Vue.js applications) and Redux (a JavaScript state container that provides predictable state management); or it can be done using the iframe (a tag in HTML that defines an inline frame that can embed another webpage into the current webpage) communication method based on postMessage (a browser application programming interface that can securely achieve cross-origin communication).

[0003] Among them, the single-page data state management tool can only operate and process data in one browser window, and has no data retention capability when refreshing the page or creating a new window; the iframe communication method based on postMessage is a way for browsers to share data across multiple windows, but it belongs to the scenario of embedded in the page and cannot truly achieve data communication and sharing between multiple browser windows, nor can it retain data.

[0004] Therefore, it is evident that existing technologies, when using single-page data state management tools to manage browser window data, have the problem that they can only manage one browser window and have no data retention capability; when using iframe communication based on postMessage to manage browser window data, there is a problem that it is impossible to truly achieve data communication and sharing between multiple browser windows and that data cannot be retained. Summary of the Invention

[0005] This application provides a data management method, apparatus, electronic device, and storage medium to solve the problem that existing single-page data state management tools cannot achieve unified data management for multiple browser windows, and that existing methods for managing data for multiple browser windows cannot truly achieve data communication and sharing between multiple browser windows, and cannot retain data.

[0006] In a first aspect, embodiments of this application provide a data management method, including:

[0007] Initialize N browser windows to cache the target data in the target storage table into the first variable corresponding to each browser window, and create a communication link between the N browser windows. N is an integer greater than or equal to 2. The target storage table is a storage table in the IndexedDB database corresponding to the browser. The target data is an object structure that includes data keys and data values.

[0008] When the target browser window triggers the update of the target data value corresponding to the target data key in the target storage table, the contents of the first variable corresponding to each of the N browser windows are updated, and the target browser window is any one of the N browser windows;

[0009] If the target data key is included in the array set, an update of the browser window corresponding to the target data key is triggered. The array set includes a first array corresponding to each of the N browser windows. The first array corresponding to the browser window includes a first data key that the browser window listens for and a data value change method corresponding to the first data key.

[0010] Secondly, embodiments of this application provide a data management device, including:

[0011] The processing module is used to initialize N browser windows, cache the target data in the target storage table into the first variable corresponding to each browser window, and create a communication link between the N browser windows. N is an integer greater than or equal to 2. The target storage table is a storage table in the IndexedDB database corresponding to the browser. The target data is an object structure that includes data keys and data values.

[0012] The first update module is used to update the contents of the first variables corresponding to the N browser windows respectively when the target browser window triggers the update of the target data value corresponding to the target data key in the target storage table. The target browser window is any one of the N browser windows.

[0013] The second update module is used to trigger an update of the browser window corresponding to the target data key when the array set includes the target data key. The array set includes a first array corresponding to each of the N browser windows. The first array corresponding to the browser window includes a first data key that the browser window listens for and a data value change method corresponding to the first data key.

[0014] Thirdly, embodiments of this application provide an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the data management method described in the first aspect above.

[0015] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the data management method described in the first aspect above.

[0016] The technical solution of this application, by initializing N browser windows, can cache target data from the target storage table into the first variable corresponding to each browser window and create communication links between the N browser windows. Based on the characteristics that the N browser windows can share data in the target storage table and the characteristics that the windows can interact, it provides a basis for unified data management of multiple browser windows under the same domain name, and data retention can be achieved by storing data based on the IndexedDB database. When the target browser window triggers an update of the target data value corresponding to the target data key in the target storage table, the content in the first variable corresponding to each of the N browser windows is updated, realizing unified data update of multiple browser windows. When the array set includes the target data key, the browser window corresponding to the target data key is updated, realizing the update of the corresponding browser window triggered by the update of the data value in the target storage table. Attached Figure Description

[0017] Figure 1 This diagram illustrates the data management method provided in an embodiment of this application.

[0018] Figure 2 This is a flowchart illustrating the initialization of the first browser window provided in an embodiment of this application.

[0019] Figure 3 This diagram illustrates the implementation principle of the data management method provided in this application.

[0020] Figure 4 This is a schematic diagram illustrating the data management device provided in an embodiment of this application;

[0021] Figure 5 This is a schematic diagram of the electronic device structure provided in the embodiments of this application. Detailed Implementation

[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.

[0024] In the various embodiments of this application, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0025] This application addresses the problem that existing single-page data state management tools cannot achieve unified data management for multiple browser windows, and that existing iframe communication methods based on postMessage cannot truly achieve data communication and sharing between multiple browser windows and cannot retain data when managing data for multiple browser windows. It provides a data management method that, based on the browser's corresponding IndexedDB database, achieves data sharing under the same domain and can retain data. Based on a window communication mechanism, it ensures interaction between different browser windows, realizing unified management of browser multi-window data under the same domain and solving the problem of the lack of browser multi-window data management capabilities.

[0026] The data management method provided in the embodiments of this application is described below. See also... Figure 1 As shown, it includes the following steps:

[0027] Step 101: Initialize N browser windows to cache the target data in the target storage table into the first variable corresponding to each browser window; create a communication link between the N browser windows, where N is an integer greater than or equal to 2; the target storage table is a storage table in the IndexedDB database corresponding to the browser; and the target data is an object structure including data keys and data values.

[0028] The method for unified data management for multiple browser windows provided in this application first initializes N browser windows, where N is an integer greater than or equal to 2. By initializing the N browser windows corresponding to the browsers, the target data in the target storage table can be cached into the first variable corresponding to each browser window, and a communication link is created between the N browser windows.

[0029] The target storage table is a table in the IndexedDB database corresponding to the browser. Based on the characteristic of IndexedDB databases that allow data sharing within the same origin (same domain), the browser's relevant data is stored in the IndexedDB database so that different browser windows under the same browser can share the data in the IndexedDB database. Furthermore, data stored in the IndexedDB database will not be automatically lost, thus ensuring data retention.

[0030] An IndexedDB database can correspond to multiple storage tables, with the target storage table being one of these tables. In this case, the target storage table stores the initialization data for N browser windows. Each record in the target storage table corresponds to a unique identifier; for example, the target storage table might have a Universally Unique Identifier (UUID) as its primary key. The target data is an object structure containing data keys and data values. In other words, the target data is a data structure corresponding to data keys and data values. Each record in the target storage table includes a data key and a data value, with different data keys distinguished by different identifiers.

[0031] N browser windows share a target storage table, and each browser window corresponds to a first variable. These variables are JavaScript variables. Through initialization, the target data in the target storage table can be cached into the first variables corresponding to the N browser windows respectively.

[0032] When initializing N browser windows and creating communication links between them, it can be understood as configuring communication functionality between any two browser windows for the N browser windows.

[0033] Step 102: When the target data value corresponding to the target data key in the target storage table is updated in the target browser window, update the contents of the first variables corresponding to the N browser windows respectively, where the target browser window is any one of the N browser windows.

[0034] After the browser window initialization is completed, when the target browser window in N browser windows triggers the update of the target data value corresponding to the target data key in the target storage table, the content in the first variable corresponding to each of the N browser windows is updated based on the update of the target data value in the target storage table.

[0035] The target browser window can be any one of the N browser windows. Since the N browser windows can share the target storage table, each of the N browser windows can trigger the update of the data value in the target storage table.

[0036] When an update of the target data value corresponding to the target data key in the target storage table is triggered, the update of the corresponding data value in the target storage table can be triggered based on the update of the target data value corresponding to the target browser window. Specifically, the target data key in the target storage table can be determined first based on the target data key corresponding to the updated target data value, and then the `put` method can be called to update the target data value corresponding to the target data key in the target storage table, thus achieving the update of the target data value corresponding to the target data key in the target storage table.

[0037] Step 103: If the target data key is included in the array set, trigger the update of the browser window corresponding to the target data key. The array set includes the first array corresponding to each of the N browser windows. The first array corresponding to the browser window includes the first data key listened to by the browser window and the data value change method corresponding to the first data key.

[0038] The array set is a pre-generated collection containing the first arrays corresponding to N browser windows. Each browser window's first array includes the first data key monitored by the browser window and the method for changing the data value corresponding to that first data key. The number of data keys corresponding to the target storage table is greater than or equal to the number of the first data keys corresponding to the array set. Furthermore, the target data key may reside in the target storage table but not in the array set, or it may reside in both the target storage table and the array set simultaneously.

[0039] When the array collection includes a target data key, an update of the browser window corresponding to the target data key can be triggered based on an update of the target data value. The update of the browser window can be at least one of the following: modification, deletion, or addition of the corresponding content in the browser window.

[0040] That is, when the target data value corresponding to the target data key is updated, the contents of the first variable corresponding to each of the N browser windows are updated, and when the target data key belongs to the data key in the array set, the browser window corresponding to the target data key is determined, and the update of the determined browser window is triggered.

[0041] The above-described implementation process of this application, by initializing N browser windows, can cache the target data in the target storage table into the first variable corresponding to each browser window and create a communication link between the N browser windows. Based on the characteristics that the N browser windows can share data in the target storage table and the characteristics that the windows can interact, it provides a basis for unified data management of multiple browser windows under the same domain name, and data retention can be achieved by storing data based on the IndexedDB database. When the target browser window triggers an update of the target data value corresponding to the target data key in the target storage table, the content in the first variable corresponding to each of the N browser windows is updated, realizing unified data update of multiple browser windows. Furthermore, when the array set includes the target data key, the browser window corresponding to the target data key is updated, realizing that the update of the data value in the target storage table triggers the update of the corresponding browser window.

[0042] The process of initializing N browser windows is described below. These N browser windows include one first browser window and at least one second browser window. Initializing the N browser windows includes:

[0043] Initialize the first browser window;

[0044] Initialize the at least one second browser window.

[0045] The N browser windows include a first browser window and at least one second browser window, where the first browser window is the main browser window and the second browser window is a child browser window. When initializing the N browser windows, the first browser window, i.e., the main browser window, is initialized first. After the initialization of the main browser window is completed, at least one second browser window, i.e., at least one child browser window, is initialized.

[0046] For cases with at least two secondary browser windows, one secondary browser window can be initialized after the primary browser window is initialized. After initializing that secondary browser window, the other secondary browser windows can be initialized in any order without affecting the logic and functionality. Alternatively, after initializing the primary browser window, at least two secondary browser windows can be initialized sequentially based on their priority order. This priority order can be preset or determined by the window's default order. By initializing the secondary browser windows sequentially according to their priority order, the orderly initialization of multiple child browser windows can be guaranteed.

[0047] By initializing the main browser window first, the child browser windows can be initialized using the same data as the main browser window.

[0048] The process of initializing the first browser window is described below. Initializing the first browser window includes: creating the IndexedDB database; creating the target storage table in the IndexedDB database and storing the data related to initialization in the target storage table; caching the target data in the target storage table into a first variable corresponding to the first browser window; creating a communication link between the first browser window and the at least one second browser window; and updating the content in the first variable corresponding to the first browser window when the content in the target storage table is updated.

[0049] IndexedDB is a NoSQL database that stores data on the browser side. Browsers have an IndexedDB database and an Application Programming Interface (API) for the IndexedDB database itself. Based on the API, the browser can operate the IndexedDB database.

[0050] When initializing the first browser window, the IndexedDB database is first created using the open method in the IndexedDB database's API to store the corresponding data for the browser. The database return value is then assigned to a JavaScript variable. This JavaScript variable stores the onsuccess method for successful creation and the onerror method for failed creation. Onsuccess and onerror are callback event methods when creating the IndexedDB database. In other words, the onsuccess method is triggered when the database is created successfully, and the onerror method is triggered when creation fails.

[0051] The `onupgradeneeded` method is triggered when creating a non-existent database using methods from the IndexedDB API, or when a higher version numeric variable is passed as a parameter during creation. The execution order is: `onupgradeneeded` first, then `onsuccess` and `onerror`. The order of `onsuccess` and `onerror` is not fixed; it depends entirely on the success of the database creation operation. Success triggers `onsuccess`, failure triggers `onerror`. After successful database creation, a target storage table is created in the IndexedDB database, storing data related to the initialization of N browser windows. Then, the `gallALL` method retrieves the target data from the target storage table and caches it in the first variable corresponding to the first browser window. This first variable is a JavaScript variable, distinct from the JavaScript variable storing the database return value mentioned earlier.

[0052] This embodiment initializes window communication through BroadcastChannel to establish a communication link between a first browser window and at least one second browser window, enabling the configuration of browser window communication capabilities. Subsequently, when data changes, data transmission and synchronization between windows are performed through BroadcastChannel. The BroadcastChannel interface proxies a named channel, allowing any browser window under a specified domain to subscribe to it, enabling communication between different browser windows of the same origin, tabs, frames, or iframes.

[0053] When the content in the target storage table is updated, the content in the first variable corresponding to the first browser window is updated. The update to the content in the target storage table can include at least one of the following: content addition, content modification, and content deletion. For content addition, this could mean that data is passed to the target storage table and new content is added based on the passed data. For content modification, this could mean that data is passed to the target storage table and the data value of at least one data key is modified based on the passed data. For content deletion, this could mean that at least one data key and its corresponding data value are deleted.

[0054] The content in the target storage table can be updated once or multiple times. For each update, the content in the first variable corresponding to the first browser window needs to be updated in a timely manner.

[0055] The following describes the process of initializing the first browser window through an implementation flowchart. (See attached document.) Figure 2 As shown, it includes the following steps:

[0056] Step 201: Create the IndexedDB database.

[0057] Step 202: Create the target storage table in the IndexedDB database and store the data related to initialization in the target storage table.

[0058] Step 203: Obtain the target data from the target storage table and cache it in the first variable corresponding to the first browser window.

[0059] Step 204: Initialize window communication via BroadcastChanne to create a communication link between the first browser window and at least one second browser window.

[0060] Step 205: If the content in the target storage table is updated, trigger the update of the content in the first variable corresponding to the first browser window.

[0061] The above process can complete the initialization of the first browser window, and the data initialization is also carried out during the initialization of the first browser window, so that the corresponding operations can be performed based on the data when initializing at least one second browser window.

[0062] The process of initializing the second browser window is described below. Initializing the second browser window includes: caching the latest target data in the target storage table into the first variable corresponding to the second browser window; creating a communication link between the second browser window and the first browser window, or creating a communication link between the second browser window and the first browser window and other second browser windows.

[0063] During the initialization of the second browser window, it is necessary to retrieve the latest target data from the target storage table and cache the retrieved target data in the first variable corresponding to the second browser window. Window communication is initialized via BroadcastChannel to establish a communication link between the current second browser window and other browser windows. Subsequently, when data changes, data transmission and synchronization between windows are performed through BroadcastChannel.

[0064] When there is only one second browser window, a communication link between the current second browser window and the first browser window can be established during the initialization of window communication. When there are at least two second browser windows, a communication link between the current second browser window and the first browser window, and a communication link between the current second browser window and other second browser windows can be established.

[0065] Since the second browser window shares the same target storage table as the first browser window, the target storage table is updated during the initialization process of the first browser window. When the second browser window is initialized, it can directly obtain the latest target storage table determined after the initialization of the first browser window and perform initialization based on the latest target storage table.

[0066] In one embodiment of this application, after initializing N browser windows, the method further includes: starting a listening function; when a browser window calls the listening function, obtaining a first data key that the browser window is listening to and a data value change method corresponding to the first data key; for each of the N browser windows, generating a first array corresponding to the browser window according to the first data key and the data value change method corresponding to the browser window; and generating the array set according to the first arrays corresponding to the N browser windows respectively.

[0067] After initializing N browser windows, the listening function can be started. Once started, for each of the N browser windows, when the listening function is invoked, the first data key and the corresponding data value change method for that browser window are obtained. For each browser window, a first array corresponding to that browser window can be generated based on the first data key and data value change method. By aggregating the first arrays corresponding to the N browser windows, an array set can be generated.

[0068] The process of generating an array collection can be understood as collecting the first data key and the corresponding data value change methods monitored by N browser windows. Similarly, the process of generating the first array corresponding to a browser window can be understood as collecting the first data key monitored by the current browser window and the corresponding data value change methods. When generating the first array corresponding to a browser window, an empty JavaScript array can be created, and the first data key monitored by the current browser window and its corresponding data value change methods can be directly pushed into this JavaScript array to generate the first array.

[0069] By generating an array set, the first data key and the data value change methods corresponding to the first data key that are being listened to by N browser windows can be aggregated. This allows the browser window to be updated based on the array set when the data value in the target storage table is updated in the target browser window.

[0070] It should be noted that after the listening function is started, when the listening function is called in the browser window, the first data key that the browser window is listening for and the data value change method corresponding to the first data key can be stored to generate the first array. It can also listen for changes in data values ​​and trigger a notification when the data values ​​are updated.

[0071] The following describes the process of updating the contents of the first variable corresponding to each of the N browser windows based on changes in data values. When the target browser window triggers an update of the target data value corresponding to the target data key in the target storage table, the contents of the first variable corresponding to each of the N browser windows are updated, including:

[0072] Update the content of the first variable corresponding to the target browser window based on the target data key and the updated target data value;

[0073] Based on the communication link between the N browser windows, the target data key and the updated target data value are passed to the first variable corresponding to other browser windows that are different from the target browser window, so as to update the content in the first variable.

[0074] In this embodiment, when the target browser window triggers an update of the target data value corresponding to the target data key in the target storage table, the content of the first variable corresponding to the target browser window can be directly updated based on the target data key and the updated target data value. Specifically, since an update of the target data value corresponding to the target browser window will trigger an update of the target data value in the target storage table, the target data key and the updated target data value can be obtained based on the target browser window, and then the content of the first variable corresponding to the target browser window can be updated based on the target data key and the updated target data value.

[0075] When updating the first variable corresponding to other browser windows that are different from the target browser window in N browser windows, the target data key and the updated target data value can be passed to the first variable corresponding to other browser windows that are different from the target browser window based on the communication link between the N browser windows, so that the content in the first variable corresponding to other browser windows will be updated.

[0076] As can be seen from the above process, when updating the content of the first variable corresponding to N browser windows based on the update of the target data value corresponding to the target data key, it is necessary to distinguish between the N browser windows. For the target browser window among the N browser windows, the content of the first variable corresponding to the target browser window can be directly updated based on the target data key and the updated target data value. For the other browser windows among the N browser windows that are different from the target browser window, the target data key and the updated target data value can be passed to the first variable corresponding to the other browser windows based on the inter-window communication function, so as to update the content of the first variable corresponding to the other browser windows.

[0077] It should be noted that after passing the target data key and the updated target data value into the first variable corresponding to another browser window that is different from the target browser window, the corresponding data value can be found based on the target data key, and the found data value can be replaced with the updated target data value.

[0078] In the above implementation process of this application, when updating the content of the first variable corresponding to N browser windows based on the update of the target data value, it is necessary to distinguish the N browser windows. Based on the target data key and the updated target data value, the content of the first variable corresponding to the target browser window is directly updated. Based on the inter-window communication function, the target data key and the updated target data value are passed to the first variable corresponding to other browser windows that are different from the target browser window, so as to update the first variable corresponding to other browser windows.

[0079] The following describes the process of updating at least a portion of N browser windows based on the updated target data value. When the array set includes the target data key, triggering the update of the browser window corresponding to the target data key includes:

[0080] Detect whether the array set includes the target data key;

[0081] If the target data key is included in the array set, at least one browser window corresponding to the target data key is determined;

[0082] Based on the target data key, the data value change method corresponding to the target data key, and the updated target data value, the update of at least one determined browser window is triggered.

[0083] In this embodiment, the array set includes first arrays corresponding to N browser windows. Each first array for a browser window includes a first data key monitored by the browser window and a method for changing the data value corresponding to that first data key. Since the number of first data keys in the first array is less than or equal to the total number of data keys corresponding to the browser windows, there may be cases where the target data key is located in the target storage table but not in the array set. When the target browser window triggers an update of the target data value corresponding to the target data key in the target storage table, it is necessary to check whether the array set includes the target data key.

[0084] If the array set includes a target data key, an update to the target data value will trigger an update in one or more browser windows out of N browser windows. In this case, it's necessary to determine at least one browser window corresponding to the target data key, and then trigger an update for that determined browser window based on the target data key, the data value change method corresponding to the target data key, and the updated target data value. When triggering an update for at least one browser window based on the target data key, the data value change method corresponding to the target data key, and the updated target data value, it's necessary to use the data value change method corresponding to the target data key, based on the monitored change in the target data value, to pass the updated target data value to the corresponding browser window to trigger the browser window update. Browser window updates can involve modifying, deleting, or adding content within the browser window. At least one browser window includes the target browser window; since the target data value of the target browser window has changed, the target browser window can be ignored when triggering its update.

[0085] In the above implementation process of this application, when the array set includes a target data key, at least one browser window corresponding to the target data key is determined. Based on the target data key, the data value change method corresponding to the target data key, and the updated target data value, the update of at least one browser window is triggered, thereby realizing the update based on the target data value and updating one or more browser windows associated with the target data key.

[0086] The data management method provided in this application is described below through an implementation principle block diagram. (See also...) Figure 3 As shown, the IndexedDB database includes a target storage table. After the target storage table is created in the IndexedDB database, the data associated with the initialization of N browser windows is cached in the target storage table. The target data in the target storage table is an object structure that includes data keys and data values.

[0087] For the first browser window (main browser window), the data in the target storage table is cached in the first variable corresponding to the first browser window, a communication link is created between the first browser window and at least one second browser window (child browser window), and the content in the first variable corresponding to the first browser window is updated when the content in the target storage table is updated, thus completing the initialization of the first browser window.

[0088] For any second browser window (child browser window), the latest target data in the target storage table is cached into the first variable corresponding to the current second browser window, a communication link is created between the current second browser window and other browser windows, and the initialization of the current second browser window is completed.

[0089] After the listening function is started, the event storage function of the event listener dispatcher is triggered to obtain the first data key and the data value change method corresponding to the first data key for each of the N browser windows. For each browser window, an empty array is created, and the first data key and the data value change method corresponding to the first data key listened to by the browser window are stored in the empty array to generate the first array. The N first arrays form an array set.

[0090] When the target browser window triggers an update of the target data value corresponding to the target data key in the target storage table, the contents of the first variable corresponding to each of the N browser windows are updated. The N browser windows include one main browser window and at least one child browser window. The target browser window can be either the main browser window or a child browser window. Specifically, when updating the first variable corresponding to the target browser window, the update can be performed directly based on the target data key and the updated target data value. When updating the first variable corresponding to other browser windows, the target data key and the updated target data value are passed to the first variable corresponding to the browser window via BroadcastChain communication to trigger the update of the first variable.

[0091] For cases where the array collection includes a target data key, at least one browser window corresponding to the target data key is determined. Based on the event notification function of the event listener dispatcher, and based on the changes in the target data value detected, the data value change method corresponding to the target data key is used to pass the updated target data value to the corresponding browser window to trigger the browser window update. This process requires the support of inter-window communication capabilities.

[0092] The above describes the overall implementation process of the data management method provided in this application. By initializing N browser windows, the target data in the target storage table can be cached in the first variable corresponding to each browser window, and a communication link can be created between the N browser windows. Based on the characteristics that the N browser windows can share data in the target storage table and the characteristics that the windows can interact, a basis is provided for unified data management of multiple browser windows under the same domain name. Data retention can be achieved by storing data based on the IndexedDB database. When the target browser window triggers the update of the target data value corresponding to the target data key in the target storage table, the content in the first variable corresponding to each of the N browser windows is updated, realizing unified data update of multiple browser windows. When the array set includes the target data key, the browser window corresponding to the target data key is updated, realizing the update of the corresponding browser window triggered by the update of the data value in the target storage table.

[0093] Furthermore, data initialization is implemented during the initialization of the first browser window, which can be used to perform corresponding operations when initializing at least one second browser window. By generating an array set, the first data key and the data value change methods corresponding to the first data key listened to by N browser windows can be aggregated, so that when the target browser window triggers the data value update in the target storage table, the array set can be used to detect whether the browser window needs to be updated.

[0094] When updating the content of the first variable corresponding to N browser windows based on the target data value, by distinguishing the N browser windows, a corresponding update strategy can be adopted for updating the first variable for different browser windows; when the array set includes the target data key, at least one browser window corresponding to the target data key is found, and the update of at least one browser window is triggered, so as to realize the update based on the target data value and update one or more browser windows associated with the target data key.

[0095] This application provides a data management device, see [link to relevant documentation] Figure 4 As shown, the data management device includes:

[0096] Processing module 401 is used to initialize N browser windows to cache the target data in the target storage table into the first variable corresponding to each browser window and create a communication link between the N browser windows. N is an integer greater than or equal to 2. The target storage table is a storage table in the IndexedDB database corresponding to the browser. The target data is an object structure that includes data keys and data values.

[0097] The first update module 402 is used to update the contents of the first variables corresponding to the N browser windows respectively when the target browser window triggers the update of the target data value corresponding to the target data key in the target storage table. The target browser window is any one of the N browser windows.

[0098] The second update module 403 is used to trigger an update of the browser window corresponding to the target data key when the array set includes the target data key. The array set includes a first array corresponding to each of the N browser windows. The first array corresponding to the browser window includes a first data key that the browser window listens for and a data value change method corresponding to the first data key.

[0099] Optionally, the N browser windows include a first browser window and at least one second browser window; the processing module includes:

[0100] The first processing submodule is used to initialize the first browser window;

[0101] The second processing submodule is used to initialize the at least one second browser window.

[0102] Optionally, the first processing submodule includes:

[0103] The first storage unit is created for creating the IndexedDB database;

[0104] The second storage unit is used to create the target storage table in the IndexedDB database and store the data related to initialization in the target storage table;

[0105] The first caching unit is used to cache the target data in the target storage table into the first variable corresponding to the first browser window;

[0106] The first creation unit is used to create a communication link between the first browser window and the at least one second browser window;

[0107] The update unit is used to update the content in the first variable corresponding to the first browser window when the content in the target storage table is updated.

[0108] Optionally, the second processing submodule includes:

[0109] The second caching unit is used to cache the latest target data in the target storage table into the first variable corresponding to the second browser window;

[0110] The second creation unit is used to create a communication link between the second browser window and the first browser window, or to create a communication link between the second browser window and the first browser window and other second browser windows.

[0111] Optionally, the device further includes:

[0112] The startup module is used to start the listening function after the processing module initializes N browser windows;

[0113] The acquisition module is used to acquire the first data key that the browser window is listening to and the data value change method corresponding to the first data key when the listening function is called in the browser window;

[0114] The first generation module is used to generate a first array corresponding to each of the N browser windows, based on the first data key and data value change method corresponding to the browser window.

[0115] The second generation module is used to generate the array set according to the first array corresponding to each of the N browser windows.

[0116] Optionally, the first update module includes:

[0117] The first update submodule is used to update the content of the first variable corresponding to the target browser window according to the target data key and the updated target data value;

[0118] The input submodule is used to, based on the communication link between the N browser windows, input the target data key and the updated target data value into the first variables corresponding to the other browser windows that are different from the target browser window, so as to update the content in the first variables.

[0119] Optionally, the second update module includes:

[0120] The detection submodule is used to detect whether the array set includes the target data key;

[0121] A determination submodule is configured to determine at least one browser window corresponding to the target data key when the array set includes the target data key;

[0122] The second update submodule is used to trigger the update of at least one determined browser window based on the target data key, the data value change method corresponding to the target data key, and the updated target data value.

[0123] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0124] This application also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described data management method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here.

[0125] For example, Figure 5 A schematic diagram of the physical structure of an electronic device is shown. See also... Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 530. The processor 510 is used to perform the following steps: initializing N browser windows to cache target data from the target storage table into the first variables corresponding to each browser window; creating communication links between the N browser windows, where N is an integer greater than or equal to 2, the target storage table is a storage table in the IndexedDB database corresponding to the browser, and the target data is an object structure including data keys and data values; when the target browser window triggers an update of the target data value corresponding to the target data key in the target storage table, updating the contents of the first variables corresponding to each of the N browser windows, where the target browser window is any one of the N browser windows; when the array set includes the target data key, triggering an update of the browser window corresponding to the target data key, where the array set includes the first array corresponding to each of the N browser windows, and the first array corresponding to the browser window includes the first data key listened to by the browser window and the data value change method corresponding to the first data key. Of course, the processor 510 can also execute other schemes in the embodiments of this application, which will not be further described here.

[0126] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.

[0127] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described data management method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0128] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0129] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0130] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0131] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0132] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0133] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0134] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0135] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0136] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0137] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data management method characterized by, include: Initialize N browser windows to cache the target data in the target storage table into the first variable corresponding to each browser window, and create a communication link between the N browser windows. N is an integer greater than or equal to 2. The target storage table is a storage table in the IndexedDB database corresponding to the browser. The target data is an object structure that includes data keys and data values. When the target browser window triggers the update of the target data value corresponding to the target data key in the target storage table, the contents of the first variable corresponding to each of the N browser windows are updated, and the target browser window is any one of the N browser windows; If the target data key is included in the array set, an update of the browser window corresponding to the target data key is triggered. The array set includes a first array corresponding to each of the N browser windows. The first array corresponding to each browser window includes a first data key that the browser window is listening to and a data value change method corresponding to the first data key. The array set is generated through the following steps: starting the listening function; responding to the call of the listening function by each browser window, obtaining the first data key that the browser window is listening to and the data value change method corresponding to the first data key, so as to generate the first array corresponding to the current browser window. Aggregate the first array of N browser windows to generate the array set; Creating a communication link between the N browser windows includes configuring communication functionality between any two browser windows for the N browser windows.

2. The method of claim 1, wherein, The N browser windows include a first browser window and at least one second browser window; The initialization of N browser windows includes: Initialize the first browser window; Initialize the at least one second browser window.

3. The method according to claim 2, characterized in that, Initializing the first browser window includes: Create the IndexedDB database; Create the target storage table in the IndexedDB database and store the data related to initialization in the target storage table; The target data in the target storage table is cached in the first variable corresponding to the first browser window; Create a communication link between the first browser window and the at least one second browser window; When the content in the target storage table is updated, the content in the first variable corresponding to the first browser window is updated.

4. The method according to claim 3, characterized in that, When initializing the second browser window, the following is included: The latest target data in the target storage table is cached in the first variable corresponding to the second browser window; Create a communication link between the second browser window and the first browser window, or create a communication link between the second browser window and the first browser window and other second browser windows.

5. The method according to claim 1, characterized in that, After initializing N browser windows, the method further includes: Start the listening function; When the listening function is invoked in the browser window, obtain the first data key that the browser window is listening for and the data value change method corresponding to the first data key; For each of the N browser windows, a first array corresponding to the browser window is generated according to the first data key and data value change method corresponding to the browser window; The array set is generated based on the first array corresponding to each of the N browser windows.

6. The method according to claim 1, characterized in that, When the target data value corresponding to the target data key in the target storage table is updated in the target browser window, updating the content of the first variable corresponding to each of the N browser windows includes: Update the content of the first variable corresponding to the target browser window based on the target data key and the updated target data value; Based on the communication link between the N browser windows, the target data key and the updated target data value are passed to the first variables corresponding to the other browser windows that are different from the target browser window in the N browser windows, so as to update the content in the first variables.

7. The method according to claim 1, characterized in that, When the array collection includes the target data key, triggering an update of the browser window corresponding to the target data key includes: Detect whether the array set includes the target data key; If the target data key is included in the array set, at least one browser window corresponding to the target data key is determined; Based on the target data key, the data value change method corresponding to the target data key, and the updated target data value, the update of at least one determined browser window is triggered.

8. A data management device, characterized in that, include: The processing module is used to initialize N browser windows, cache the target data in the target storage table into the first variable corresponding to each browser window, and create a communication link between the N browser windows. N is an integer greater than or equal to 2. The target storage table is a storage table in the IndexedDB database corresponding to the browser. The target data is an object structure that includes data keys and data values. The first update module is used to update the contents of the first variables corresponding to the N browser windows respectively when the target browser window triggers the update of the target data value corresponding to the target data key in the target storage table. The target browser window is any one of the N browser windows. The second update module is used to trigger an update of the browser window corresponding to the target data key when the array set includes the target data key. The array set includes a first array corresponding to each of the N browser windows. The first array corresponding to the browser window includes a first data key that the browser window listens for and a data value change method corresponding to the first data key. The array set is generated through the following steps: starting the listening function; responding to the call of the listening function by each browser window, obtaining the first data key that the browser window listens for and the data value change method corresponding to the first data key, so as to generate the first array corresponding to the current browser window. Aggregate the first array of N browser windows to generate the array set; Creating a communication link between the N browser windows includes configuring communication functionality between any two browser windows for the N browser windows.

9. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the data management method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the data management method as described in any one of claims 1 to 7.