@tanstack/query-broadcast-client-experimental 4.0.0 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/node_modules/broadcast-channel/dist/es/broadcast-channel.js +260 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/broadcast-channel.js.map +1 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/method-chooser.js +83 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/method-chooser.js.map +1 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/methods/indexed-db.js +325 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/methods/indexed-db.js.map +1 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/methods/localstorage.js +193 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/methods/localstorage.js.map +1 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/methods/native.js +88 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/methods/native.js.map +1 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/methods/simulate.js +77 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/methods/simulate.js.map +1 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/options.js +41 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/options.js.map +1 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/util.js +77 -0
- package/build/cjs/node_modules/broadcast-channel/dist/es/util.js.map +1 -0
- package/build/cjs/node_modules/oblivious-set/dist/es/index.js +83 -0
- package/build/cjs/node_modules/oblivious-set/dist/es/index.js.map +1 -0
- package/build/stats-html.html +1 -1
- package/build/stats.json +427 -0
- package/build/types/query-broadcast-client-experimental/src/index.d.ts +7 -0
- package/build/types/query-core/src/focusManager.d.ts +16 -0
- package/build/types/query-core/src/hydration.d.ts +34 -0
- package/build/types/query-core/src/index.d.ts +20 -0
- package/build/types/query-core/src/infiniteQueryBehavior.d.ts +15 -0
- package/build/types/query-core/src/infiniteQueryObserver.d.ts +18 -0
- package/build/types/query-core/src/logger.d.ts +8 -0
- package/build/types/query-core/src/mutation.d.ts +70 -0
- package/build/types/query-core/src/mutationCache.d.ts +52 -0
- package/build/types/query-core/src/mutationObserver.d.ts +23 -0
- package/build/types/query-core/src/notifyManager.d.ts +18 -0
- package/build/types/query-core/src/onlineManager.d.ts +16 -0
- package/build/types/query-core/src/queriesObserver.d.ts +23 -0
- package/build/types/query-core/src/query.d.ts +119 -0
- package/build/types/query-core/src/queryCache.d.ts +59 -0
- package/build/types/query-core/src/queryClient.d.ts +65 -0
- package/build/types/query-core/src/queryObserver.d.ts +61 -0
- package/build/types/query-core/src/removable.d.ts +9 -0
- package/build/types/query-core/src/retryer.d.ts +33 -0
- package/build/types/query-core/src/subscribable.d.ts +10 -0
- package/build/types/query-core/src/types.d.ts +417 -0
- package/build/types/query-core/src/utils.d.ts +99 -0
- package/package.json +2 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* query-broadcast-client-experimental
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
var util = require('../util.js');
|
|
16
|
+
|
|
17
|
+
var microSeconds = util.microSeconds;
|
|
18
|
+
var type = 'simulate';
|
|
19
|
+
var SIMULATE_CHANNELS = new Set();
|
|
20
|
+
function create(channelName) {
|
|
21
|
+
var state = {
|
|
22
|
+
name: channelName,
|
|
23
|
+
messagesCallback: null
|
|
24
|
+
};
|
|
25
|
+
SIMULATE_CHANNELS.add(state);
|
|
26
|
+
return state;
|
|
27
|
+
}
|
|
28
|
+
function close(channelState) {
|
|
29
|
+
SIMULATE_CHANNELS["delete"](channelState);
|
|
30
|
+
}
|
|
31
|
+
function postMessage(channelState, messageJson) {
|
|
32
|
+
return new Promise(function (res) {
|
|
33
|
+
return setTimeout(function () {
|
|
34
|
+
var channelArray = Array.from(SIMULATE_CHANNELS);
|
|
35
|
+
channelArray.filter(function (channel) {
|
|
36
|
+
return channel.name === channelState.name;
|
|
37
|
+
}).filter(function (channel) {
|
|
38
|
+
return channel !== channelState;
|
|
39
|
+
}).filter(function (channel) {
|
|
40
|
+
return !!channel.messagesCallback;
|
|
41
|
+
}).forEach(function (channel) {
|
|
42
|
+
return channel.messagesCallback(messageJson);
|
|
43
|
+
});
|
|
44
|
+
res();
|
|
45
|
+
}, 5);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function onMessage(channelState, fn) {
|
|
49
|
+
channelState.messagesCallback = fn;
|
|
50
|
+
}
|
|
51
|
+
function canBeUsed() {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
function averageResponseTime() {
|
|
55
|
+
return 5;
|
|
56
|
+
}
|
|
57
|
+
var SimulateMethod = {
|
|
58
|
+
create: create,
|
|
59
|
+
close: close,
|
|
60
|
+
onMessage: onMessage,
|
|
61
|
+
postMessage: postMessage,
|
|
62
|
+
canBeUsed: canBeUsed,
|
|
63
|
+
type: type,
|
|
64
|
+
averageResponseTime: averageResponseTime,
|
|
65
|
+
microSeconds: microSeconds
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.averageResponseTime = averageResponseTime;
|
|
69
|
+
exports.canBeUsed = canBeUsed;
|
|
70
|
+
exports.close = close;
|
|
71
|
+
exports.create = create;
|
|
72
|
+
exports["default"] = SimulateMethod;
|
|
73
|
+
exports.microSeconds = microSeconds;
|
|
74
|
+
exports.onMessage = onMessage;
|
|
75
|
+
exports.postMessage = postMessage;
|
|
76
|
+
exports.type = type;
|
|
77
|
+
//# sourceMappingURL=simulate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulate.js","sources":["../../../../../../../../../node_modules/broadcast-channel/dist/es/methods/simulate.js"],"sourcesContent":["import { microSeconds as micro } from '../util';\nexport var microSeconds = micro;\nexport var type = 'simulate';\nvar SIMULATE_CHANNELS = new Set();\nexport function create(channelName) {\n var state = {\n name: channelName,\n messagesCallback: null\n };\n SIMULATE_CHANNELS.add(state);\n return state;\n}\nexport function close(channelState) {\n SIMULATE_CHANNELS[\"delete\"](channelState);\n}\nexport function postMessage(channelState, messageJson) {\n return new Promise(function (res) {\n return setTimeout(function () {\n var channelArray = Array.from(SIMULATE_CHANNELS);\n channelArray.filter(function (channel) {\n return channel.name === channelState.name;\n }).filter(function (channel) {\n return channel !== channelState;\n }).filter(function (channel) {\n return !!channel.messagesCallback;\n }).forEach(function (channel) {\n return channel.messagesCallback(messageJson);\n });\n res();\n }, 5);\n });\n}\nexport function onMessage(channelState, fn) {\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n return true;\n}\nexport function averageResponseTime() {\n return 5;\n}\nexport default {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};"],"names":["micro"],"mappings":";;;;;;;;;;;;;;;;AACU,IAAC,YAAY,GAAGA,kBAAM;AACtB,IAAC,IAAI,GAAG,WAAW;AAC7B,IAAI,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;AAC3B,SAAS,MAAM,CAAC,WAAW,EAAE;AACpC,EAAE,IAAI,KAAK,GAAG;AACd,IAAI,IAAI,EAAE,WAAW;AACrB,IAAI,gBAAgB,EAAE,IAAI;AAC1B,GAAG,CAAC;AACJ,EAAE,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC/B,EAAE,OAAO,KAAK,CAAC;AACf,CAAC;AACM,SAAS,KAAK,CAAC,YAAY,EAAE;AACpC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,YAAY,C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AAE,IAAI;AACZ,EAAE,mBAAmB,EAAE,mBAAmB;AAC1C,EAAE,YAAY,EAAE,YAAY;AAC5B,CAAC;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* query-broadcast-client-experimental
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
function fillOptionsWithDefaults() {
|
|
16
|
+
var originalOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17
|
+
var options = JSON.parse(JSON.stringify(originalOptions)); // main
|
|
18
|
+
|
|
19
|
+
if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true; // indexed-db
|
|
20
|
+
|
|
21
|
+
if (!options.idb) options.idb = {}; // after this time the messages get deleted
|
|
22
|
+
|
|
23
|
+
if (!options.idb.ttl) options.idb.ttl = 1000 * 45;
|
|
24
|
+
if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 150; // handles abrupt db onclose events.
|
|
25
|
+
|
|
26
|
+
if (originalOptions.idb && typeof originalOptions.idb.onclose === 'function') options.idb.onclose = originalOptions.idb.onclose; // localstorage
|
|
27
|
+
|
|
28
|
+
if (!options.localstorage) options.localstorage = {};
|
|
29
|
+
if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60; // custom methods
|
|
30
|
+
|
|
31
|
+
if (originalOptions.methods) options.methods = originalOptions.methods; // node
|
|
32
|
+
|
|
33
|
+
if (!options.node) options.node = {};
|
|
34
|
+
if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes;
|
|
35
|
+
|
|
36
|
+
if (typeof options.node.useFastPath === 'undefined') options.node.useFastPath = true;
|
|
37
|
+
return options;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.fillOptionsWithDefaults = fillOptionsWithDefaults;
|
|
41
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sources":["../../../../../../../../node_modules/broadcast-channel/dist/es/options.js"],"sourcesContent":["export function fillOptionsWithDefaults() {\n var originalOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = JSON.parse(JSON.stringify(originalOptions)); // main\n\n if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true; // indexed-db\n\n if (!options.idb) options.idb = {}; // after this time the messages get deleted\n\n if (!options.idb.ttl) options.idb.ttl = 1000 * 45;\n if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 150; // handles abrupt db onclose events.\n\n if (originalOptions.idb && typeof originalOptions.idb.onclose === 'function') options.idb.onclose = originalOptions.idb.onclose; // localstorage\n\n if (!options.localstorage) options.localstorage = {};\n if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60; // custom methods\n\n if (originalOptions.methods) options.methods = originalOptions.methods; // node\n\n if (!options.node) options.node = {};\n if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes;\n\n if (typeof options.node.useFastPath === 'undefined') options.node.useFastPath = true;\n return options;\n}"],"names":[],"mappings":";;;;;;;;;;;;;;AAAO,SAAS,uBAAuB,GAAG;AAC1C,EAAE,IAAI,eAAe,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAC/F,EAAE,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;AAC5D;AACA,EAAE,IAAI,OAAO,OAAO,CAAC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OAAO,OAAO,CAAC;AACjB;;;;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* query-broadcast-client-experimental
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* returns true if the given object is a promise
|
|
17
|
+
*/
|
|
18
|
+
function isPromise(obj) {
|
|
19
|
+
if (obj && typeof obj.then === 'function') {
|
|
20
|
+
return true;
|
|
21
|
+
} else {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function sleep(time) {
|
|
26
|
+
if (!time) time = 0;
|
|
27
|
+
return new Promise(function (res) {
|
|
28
|
+
return setTimeout(res, time);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function randomInt(min, max) {
|
|
32
|
+
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* https://stackoverflow.com/a/8084248
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
function randomToken() {
|
|
39
|
+
return Math.random().toString(36).substring(2);
|
|
40
|
+
}
|
|
41
|
+
var lastMs = 0;
|
|
42
|
+
var additional = 0;
|
|
43
|
+
/**
|
|
44
|
+
* returns the current time in micro-seconds,
|
|
45
|
+
* WARNING: This is a pseudo-function
|
|
46
|
+
* Performance.now is not reliable in webworkers, so we just make sure to never return the same time.
|
|
47
|
+
* This is enough in browsers, and this function will not be used in nodejs.
|
|
48
|
+
* The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
function microSeconds() {
|
|
52
|
+
var ms = new Date().getTime();
|
|
53
|
+
|
|
54
|
+
if (ms === lastMs) {
|
|
55
|
+
additional++;
|
|
56
|
+
return ms * 1000 + additional;
|
|
57
|
+
} else {
|
|
58
|
+
lastMs = ms;
|
|
59
|
+
additional = 0;
|
|
60
|
+
return ms * 1000;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* copied from the 'detect-node' npm module
|
|
65
|
+
* We cannot use the module directly because it causes problems with rollup
|
|
66
|
+
* @link https://github.com/iliakan/detect-node/blob/master/index.js
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
var isNode = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
|
|
70
|
+
|
|
71
|
+
exports.isNode = isNode;
|
|
72
|
+
exports.isPromise = isPromise;
|
|
73
|
+
exports.microSeconds = microSeconds;
|
|
74
|
+
exports.randomInt = randomInt;
|
|
75
|
+
exports.randomToken = randomToken;
|
|
76
|
+
exports.sleep = sleep;
|
|
77
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../../../../node_modules/broadcast-channel/dist/es/util.js"],"sourcesContent":["/**\n * returns true if the given object is a promise\n */\nexport function isPromise(obj) {\n if (obj && typeof obj.then === 'function') {\n return true;\n } else {\n return false;\n }\n}\nexport function sleep(time) {\n if (!time) time = 0;\n return new Promise(function (res) {\n return setTimeout(res, time);\n });\n}\nexport function randomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\n/**\n * https://stackoverflow.com/a/8084248\n */\n\nexport function randomToken() {\n return Math.random().toString(36).substring(2);\n}\nvar lastMs = 0;\nvar additional = 0;\n/**\n * returns the current time in micro-seconds,\n * WARNING: This is a pseudo-function\n * Performance.now is not reliable in webworkers, so we just make sure to never return the same time.\n * This is enough in browsers, and this function will not be used in nodejs.\n * The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.\n */\n\nexport function microSeconds() {\n var ms = new Date().getTime();\n\n if (ms === lastMs) {\n additional++;\n return ms * 1000 + additional;\n } else {\n lastMs = ms;\n additional = 0;\n return ms * 1000;\n }\n}\n/**\n * copied from the 'detect-node' npm module\n * We cannot use the module directly because it causes problems with rollup\n * @link https://github.com/iliakan/detect-node/blob/master/index.js\n */\n\nexport var isNode = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACO,SAAS,SAAS,CAAC,GAAG,EAAE;AAC/B,EAAE,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE;AAC7C,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,MAAM;AACT,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH,CAAC;AACM,SAAS,KAAK,CAAC,IAAI,EAAE;AAC5B,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC;AACtB,EAAE,OAAO,IAAI,OAAO,CAAC,UAAU,GAAG,EAAE;AACpC,IAAI,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACjC,GAAG,CAAC,CAAC;AACL,CAAC;AACM,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE;AACpC,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AAC3D,CAAC;AACD;AACA;AACA;AACA;AACO,SAAS,WAAW,GAAG;AAC9B,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AACD,IAAI,MAAM,GAAG,CAAC,CAAC;AACf,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAY,GAAG;AAC/B,EAAE,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAChC;AACA,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE;AACrB,IAAI,UAAU,EAAE,CAAC;AACjB,IAAI,OAAO,EAAE,GAAG,IAAI,GAAG,UAAU,CAAC;AAClC,GAAG,MAAM;AACT,IAAI,MAAM,GAAG,EAAE,CAAC;AAChB,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,IAAI,OAAO,EAAE,GAAG,IAAI,CAAC;AACrB,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACU,IAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,OAAO,KAAK,WAAW,GAAG,OAAO,GAAG,CAAC,CAAC,KAAK;;;;;;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* query-broadcast-client-experimental
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* this is a set which automatically forgets
|
|
17
|
+
* a given entry when a new entry is set and the ttl
|
|
18
|
+
* of the old one is over
|
|
19
|
+
*/
|
|
20
|
+
var ObliviousSet = /** @class */ (function () {
|
|
21
|
+
function ObliviousSet(ttl) {
|
|
22
|
+
this.ttl = ttl;
|
|
23
|
+
this.set = new Set();
|
|
24
|
+
this.timeMap = new Map();
|
|
25
|
+
}
|
|
26
|
+
ObliviousSet.prototype.has = function (value) {
|
|
27
|
+
return this.set.has(value);
|
|
28
|
+
};
|
|
29
|
+
ObliviousSet.prototype.add = function (value) {
|
|
30
|
+
var _this = this;
|
|
31
|
+
this.timeMap.set(value, now());
|
|
32
|
+
this.set.add(value);
|
|
33
|
+
/**
|
|
34
|
+
* When a new value is added,
|
|
35
|
+
* start the cleanup at the next tick
|
|
36
|
+
* to not block the cpu for more important stuff
|
|
37
|
+
* that might happen.
|
|
38
|
+
*/
|
|
39
|
+
setTimeout(function () {
|
|
40
|
+
removeTooOldValues(_this);
|
|
41
|
+
}, 0);
|
|
42
|
+
};
|
|
43
|
+
ObliviousSet.prototype.clear = function () {
|
|
44
|
+
this.set.clear();
|
|
45
|
+
this.timeMap.clear();
|
|
46
|
+
};
|
|
47
|
+
return ObliviousSet;
|
|
48
|
+
}());
|
|
49
|
+
/**
|
|
50
|
+
* Removes all entries from the set
|
|
51
|
+
* where the TTL has expired
|
|
52
|
+
*/
|
|
53
|
+
function removeTooOldValues(obliviousSet) {
|
|
54
|
+
var olderThen = now() - obliviousSet.ttl;
|
|
55
|
+
var iterator = obliviousSet.set[Symbol.iterator]();
|
|
56
|
+
/**
|
|
57
|
+
* Because we can assume the new values are added at the bottom,
|
|
58
|
+
* we start from the top and stop as soon as we reach a non-too-old value.
|
|
59
|
+
*/
|
|
60
|
+
while (true) {
|
|
61
|
+
var value = iterator.next().value;
|
|
62
|
+
if (!value) {
|
|
63
|
+
return; // no more elements
|
|
64
|
+
}
|
|
65
|
+
var time = obliviousSet.timeMap.get(value);
|
|
66
|
+
if (time < olderThen) {
|
|
67
|
+
obliviousSet.timeMap.delete(value);
|
|
68
|
+
obliviousSet.set.delete(value);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// We reached a value that is not old enough
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function now() {
|
|
77
|
+
return new Date().getTime();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
exports.ObliviousSet = ObliviousSet;
|
|
81
|
+
exports.now = now;
|
|
82
|
+
exports.removeTooOldValues = removeTooOldValues;
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/oblivious-set/dist/es/index.js"],"sourcesContent":["/**\n * this is a set which automatically forgets\n * a given entry when a new entry is set and the ttl\n * of the old one is over\n */\nvar ObliviousSet = /** @class */ (function () {\n function ObliviousSet(ttl) {\n this.ttl = ttl;\n this.set = new Set();\n this.timeMap = new Map();\n }\n ObliviousSet.prototype.has = function (value) {\n return this.set.has(value);\n };\n ObliviousSet.prototype.add = function (value) {\n var _this = this;\n this.timeMap.set(value, now());\n this.set.add(value);\n /**\n * When a new value is added,\n * start the cleanup at the next tick\n * to not block the cpu for more important stuff\n * that might happen.\n */\n setTimeout(function () {\n removeTooOldValues(_this);\n }, 0);\n };\n ObliviousSet.prototype.clear = function () {\n this.set.clear();\n this.timeMap.clear();\n };\n return ObliviousSet;\n}());\nexport { ObliviousSet };\n/**\n * Removes all entries from the set\n * where the TTL has expired\n */\nexport function removeTooOldValues(obliviousSet) {\n var olderThen = now() - obliviousSet.ttl;\n var iterator = obliviousSet.set[Symbol.iterator]();\n /**\n * Because we can assume the new values are added at the bottom,\n * we start from the top and stop as soon as we reach a non-too-old value.\n */\n while (true) {\n var value = iterator.next().value;\n if (!value) {\n return; // no more elements\n }\n var time = obliviousSet.timeMap.get(value);\n if (time < olderThen) {\n obliviousSet.timeMap.delete(value);\n obliviousSet.set.delete(value);\n }\n else {\n // We reached a value that is not old enough\n return;\n }\n }\n}\nexport function now() {\n return new Date().getTime();\n}\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACG,IAAC,YAAY,kBAAkB,YAAY;AAC9C,IAAI,SAAS,YAAY,CAAC,GAAG,EAAE;AAC/B,QAAQ,IAAI,CAA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OAAO,IAAI,EAAE;AACjB,QAAQ,IAAI,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;AAC1C,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,IAAI,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACnD,QAAQ,IAAI,IAAI,GAAG,SAAS,EAAE;AAC9B,YAAY,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/C,YAAY,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3C,SAAS;AACT,aAAa;AACb;AACA,YAAY,OAAO;AACnB,SAAS;AACT,KAAK;AACL,CAAC;AACM,SAAS,GAAG,GAAG;AACtB,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAChC;;;;;;"}
|
package/build/stats-html.html
CHANGED
|
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
|
|
|
2669
2669
|
</script>
|
|
2670
2670
|
<script>
|
|
2671
2671
|
/*<!--*/
|
|
2672
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"node_modules","children":[{"name":"broadcast-channel/dist/es","children":[{"uid":"
|
|
2672
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"node_modules","children":[{"name":"broadcast-channel/dist/es","children":[{"uid":"f3f3-91","name":"util.js"},{"name":"methods","children":[{"uid":"f3f3-93","name":"native.js"},{"uid":"f3f3-99","name":"indexed-db.js"},{"uid":"f3f3-101","name":"localstorage.js"},{"uid":"f3f3-103","name":"simulate.js"}]},{"uid":"f3f3-97","name":"options.js"},{"uid":"f3f3-105","name":"method-chooser.js"},{"uid":"f3f3-107","name":"broadcast-channel.js"}]},{"name":"oblivious-set/dist/es/index.js","uid":"f3f3-95"}]},{"name":"packages/query-broadcast-client-experimental/src/index.ts","uid":"f3f3-109"}]}],"isRoot":true},"nodeParts":{"f3f3-91":{"renderedLength":1601,"gzipLength":792,"brotliLength":0,"mainUid":"f3f3-90"},"f3f3-93":{"renderedLength":1626,"gzipLength":657,"brotliLength":0,"mainUid":"f3f3-92"},"f3f3-95":{"renderedLength":1973,"gzipLength":727,"brotliLength":0,"mainUid":"f3f3-94"},"f3f3-97":{"renderedLength":1205,"gzipLength":474,"brotliLength":0,"mainUid":"f3f3-96"},"f3f3-99":{"renderedLength":8613,"gzipLength":2551,"brotliLength":0,"mainUid":"f3f3-98"},"f3f3-101":{"renderedLength":4823,"gzipLength":1838,"brotliLength":0,"mainUid":"f3f3-100"},"f3f3-103":{"renderedLength":1381,"gzipLength":477,"brotliLength":0,"mainUid":"f3f3-102"},"f3f3-105":{"renderedLength":1738,"gzipLength":755,"brotliLength":0,"mainUid":"f3f3-104"},"f3f3-107":{"renderedLength":6028,"gzipLength":1726,"brotliLength":0,"mainUid":"f3f3-106"},"f3f3-109":{"renderedLength":1707,"gzipLength":503,"brotliLength":0,"mainUid":"f3f3-108"}},"nodeMetas":{"f3f3-90":{"id":"/node_modules/broadcast-channel/dist/es/util.js","moduleParts":{"index.production.js":"f3f3-91"},"imported":[],"importedBy":[{"uid":"f3f3-106"},{"uid":"f3f3-111"},{"uid":"f3f3-104"},{"uid":"f3f3-92"},{"uid":"f3f3-98"},{"uid":"f3f3-100"},{"uid":"f3f3-102"}]},"f3f3-92":{"id":"/node_modules/broadcast-channel/dist/es/methods/native.js","moduleParts":{"index.production.js":"f3f3-93"},"imported":[{"uid":"f3f3-90"}],"importedBy":[{"uid":"f3f3-104"}]},"f3f3-94":{"id":"/node_modules/oblivious-set/dist/es/index.js","moduleParts":{"index.production.js":"f3f3-95"},"imported":[],"importedBy":[{"uid":"f3f3-98"},{"uid":"f3f3-100"}]},"f3f3-96":{"id":"/node_modules/broadcast-channel/dist/es/options.js","moduleParts":{"index.production.js":"f3f3-97"},"imported":[],"importedBy":[{"uid":"f3f3-106"},{"uid":"f3f3-98"},{"uid":"f3f3-100"}]},"f3f3-98":{"id":"/node_modules/broadcast-channel/dist/es/methods/indexed-db.js","moduleParts":{"index.production.js":"f3f3-99"},"imported":[{"uid":"f3f3-90"},{"uid":"f3f3-94"},{"uid":"f3f3-96"}],"importedBy":[{"uid":"f3f3-104"}]},"f3f3-100":{"id":"/node_modules/broadcast-channel/dist/es/methods/localstorage.js","moduleParts":{"index.production.js":"f3f3-101"},"imported":[{"uid":"f3f3-94"},{"uid":"f3f3-96"},{"uid":"f3f3-90"}],"importedBy":[{"uid":"f3f3-104"}]},"f3f3-102":{"id":"/node_modules/broadcast-channel/dist/es/methods/simulate.js","moduleParts":{"index.production.js":"f3f3-103"},"imported":[{"uid":"f3f3-90"}],"importedBy":[{"uid":"f3f3-104"}]},"f3f3-104":{"id":"/node_modules/broadcast-channel/dist/es/method-chooser.js","moduleParts":{"index.production.js":"f3f3-105"},"imported":[{"uid":"f3f3-92"},{"uid":"f3f3-98"},{"uid":"f3f3-100"},{"uid":"f3f3-102"},{"uid":"f3f3-90"}],"importedBy":[{"uid":"f3f3-106"}]},"f3f3-106":{"id":"/node_modules/broadcast-channel/dist/es/broadcast-channel.js","moduleParts":{"index.production.js":"f3f3-107"},"imported":[{"uid":"f3f3-90"},{"uid":"f3f3-104"},{"uid":"f3f3-96"}],"importedBy":[{"uid":"f3f3-110"}]},"f3f3-108":{"id":"/packages/query-broadcast-client-experimental/src/index.ts","moduleParts":{"index.production.js":"f3f3-109"},"imported":[{"uid":"f3f3-110"}],"importedBy":[],"isEntry":true},"f3f3-110":{"id":"/node_modules/broadcast-channel/dist/es/index.js","moduleParts":{},"imported":[{"uid":"f3f3-106"},{"uid":"f3f3-111"}],"importedBy":[{"uid":"f3f3-108"}]},"f3f3-111":{"id":"/node_modules/broadcast-channel/dist/es/leader-election.js","moduleParts":{},"imported":[{"uid":"f3f3-90"},{"uid":"f3f3-112"}],"importedBy":[{"uid":"f3f3-110"}]},"f3f3-112":{"id":"/node_modules/unload/dist/es/index.js","moduleParts":{},"imported":[{"uid":"f3f3-113"},{"uid":"f3f3-114"},{"uid":"f3f3-115"}],"importedBy":[{"uid":"f3f3-111"}]},"f3f3-113":{"id":"/node_modules/detect-node/index.esm.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"f3f3-112"}]},"f3f3-114":{"id":"/node_modules/unload/dist/es/browser.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"f3f3-112"}]},"f3f3-115":{"id":"/node_modules/unload/dist/es/node.js","moduleParts":{},"imported":[],"importedBy":[{"uid":"f3f3-112"}]}},"env":{"rollup":"2.76.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
2673
2673
|
|
|
2674
2674
|
const run = () => {
|
|
2675
2675
|
const width = window.innerWidth;
|