@dxos/async 0.4.7-next.f4b92be → 0.4.8-main.00e6f19
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/dist/lib/browser/index.mjs +28 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +28 -6
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/debounce.d.ts +1 -1
- package/dist/types/src/debounce.d.ts.map +1 -1
- package/dist/types/src/track-leaks.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/debounce.ts +3 -3
- package/src/observable.test.ts +1 -1
- package/src/track-leaks.ts +5 -4
package/src/debounce.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Debounce callback.
|
|
7
7
|
*/
|
|
8
|
-
export const debounce =
|
|
8
|
+
export const debounce = (cb: (...args: any[]) => void, wait = 100): ((...args: any[]) => void) => {
|
|
9
9
|
let t: ReturnType<typeof setTimeout>;
|
|
10
|
-
return (
|
|
10
|
+
return (...args: any[]) => {
|
|
11
11
|
clearTimeout(t);
|
|
12
|
-
t = setTimeout(() => cb(
|
|
12
|
+
t = setTimeout(() => cb(...args), wait);
|
|
13
13
|
};
|
|
14
14
|
};
|
package/src/observable.test.ts
CHANGED
|
@@ -147,7 +147,7 @@ describe('multicast observable', () => {
|
|
|
147
147
|
|
|
148
148
|
test('lossless concat', async () => {
|
|
149
149
|
const observable = MulticastObservable.of([1, 2, 3]);
|
|
150
|
-
const concat = observable.losslessConcat((a, b) => a.concat(...b), MulticastObservable.of([4, 5, 6]));
|
|
150
|
+
const concat = observable.losslessConcat((a: any, b: any) => a.concat(...b), MulticastObservable.of([4, 5, 6]));
|
|
151
151
|
expect(concat.get()).to.deep.equal([1, 2, 3, 4, 5, 6]);
|
|
152
152
|
});
|
|
153
153
|
});
|
package/src/track-leaks.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { StackTrace } from '@dxos/debug';
|
|
6
|
+
import { log } from '@dxos/log';
|
|
6
7
|
|
|
7
8
|
const enabled = typeof process !== 'undefined' && !!process.env.DX_TRACK_LEAKS;
|
|
8
9
|
|
|
@@ -78,11 +79,11 @@ export const dumpLeaks = () => {
|
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
log.info(`Leaked resources ${openResources.size}:`);
|
|
82
83
|
for (const resource of openResources) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
log.info(`- ${resource.name} at`);
|
|
85
|
+
log.info(resource.openStack.getStack(1));
|
|
86
|
+
log.info('\n');
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
89
|
|