@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/src/debounce.ts CHANGED
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * Debounce callback.
7
7
  */
8
- export const debounce = <T = void>(cb: (arg: T) => void, wait = 100): ((arg: T) => void) => {
8
+ export const debounce = (cb: (...args: any[]) => void, wait = 100): ((...args: any[]) => void) => {
9
9
  let t: ReturnType<typeof setTimeout>;
10
- return (arg: T) => {
10
+ return (...args: any[]) => {
11
11
  clearTimeout(t);
12
- t = setTimeout(() => cb(arg), wait);
12
+ t = setTimeout(() => cb(...args), wait);
13
13
  };
14
14
  };
@@ -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
  });
@@ -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
- console.log(`Leaked resources ${openResources.size}:`);
82
+ log.info(`Leaked resources ${openResources.size}:`);
82
83
  for (const resource of openResources) {
83
- console.log(`- ${resource.name} at`);
84
- console.log(resource.openStack.getStack(1));
85
- console.log();
84
+ log.info(`- ${resource.name} at`);
85
+ log.info(resource.openStack.getStack(1));
86
+ log.info('\n');
86
87
  }
87
88
  };
88
89