diff options
| author | Sam Wilkins <samwilkins333@gmail.com> | 2019-09-18 04:31:53 -0400 |
|---|---|---|
| committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-09-18 04:31:53 -0400 |
| commit | 30ec493a6dae644b0907f6ee6e86696c06aa11b4 (patch) | |
| tree | 52fa1d38f57386575fc888d6e804933497db468b /src/client/northstar/utils/Extensions.ts | |
| parent | 960b5babede63780bf91ce8fe8658e8c41925ecb (diff) | |
additional timeunit
Diffstat (limited to 'src/client/northstar/utils/Extensions.ts')
| -rw-r--r-- | src/client/northstar/utils/Extensions.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/client/northstar/utils/Extensions.ts b/src/client/northstar/utils/Extensions.ts index 3722bfd52..ad3e06806 100644 --- a/src/client/northstar/utils/Extensions.ts +++ b/src/client/northstar/utils/Extensions.ts @@ -42,6 +42,17 @@ interface PredicateBatcherAsync<I, A> { type Batcher<I, A> = FixedBatcher | PredicateBatcher<I, A>; type BatcherAsync<I, A> = Batcher<I, A> | PredicateBatcherAsync<I, A>; +enum TimeUnit { + Milliseconds, + Seconds, + Minutes +} + +interface Interval { + magnitude: number; + unit: TimeUnit; +} + interface Array<T> { fixedBatch<T>(batcher: FixedBatcher): T[][]; predicateBatch<T, A = undefined>(batcher: PredicateBatcher<T, A>): T[][]; @@ -55,8 +66,8 @@ interface Array<T> { batchedForEachAsync<A = undefined>(batcher: Batcher<T, A>, handler: BatchHandler<T>): Promise<void>; batchedMapAsync<O, A = undefined>(batcher: Batcher<T, A>, handler: BatchConverter<T, O>): Promise<O[]>; - batchedForEachInterval<A = undefined>(batcher: Batcher<T, A>, handler: BatchHandler<T>, interval: number): Promise<void>; - batchedMapInterval<O, A = undefined>(batcher: Batcher<T, A>, handler: BatchConverter<T, O>, interval: number): Promise<O[]>; + batchedForEachInterval<A = undefined>(batcher: Batcher<T, A>, handler: BatchHandler<T>, interval: Interval): Promise<void>; + batchedMapInterval<O, A = undefined>(batcher: Batcher<T, A>, handler: BatchConverter<T, O>, interval: Interval): Promise<O[]>; lastElement(): T; } |
