@next-core/brick-utils 2.40.0 → 2.41.0

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.
@@ -27,3 +27,4 @@ export * from "./track";
27
27
  export * from "./visitStoryboard";
28
28
  export * from "./debounceByAnimationFrame";
29
29
  export * from "./scanInstalledAppsInStoryboard";
30
+ export * from "./makeThrottledAggregation";
@@ -0,0 +1,13 @@
1
+ export declare type ThrottledAggregation<T, R> = (id: T) => Promise<R>;
2
+ /**
3
+ * Make a throttled aggregation function.
4
+ *
5
+ * Note: the `id` should be a primitive value, typically a string or a number.
6
+ * If the `id` must be an array or an object, encode it in JSON.
7
+ *
8
+ * @param namespace Should be unique for each purpose.
9
+ * @param request Accept ids, fire request and return the promise.
10
+ * @param select Select the specific data for a specific id in the aggregated result.
11
+ * @param wait Throttle wait time in milliseconds, defaults to 100.
12
+ */
13
+ export declare function makeThrottledAggregation<T extends string | number, S, R>(namespace: string, request: (ids: T[]) => Promise<S>, select: (result: S, id: T) => R, wait?: number): ThrottledAggregation<T, R>;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/brick-utils",
3
- "version": "2.40.0",
3
+ "version": "2.41.0",
4
4
  "description": "Pure utility functions for kernel",
5
5
  "homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/brick-utils",
6
6
  "license": "GPL-3.0",
@@ -46,5 +46,5 @@
46
46
  "lodash": "*",
47
47
  "moment": "*"
48
48
  },
49
- "gitHead": "290ad67518280f6eec544d6fe3a7d8476189793a"
49
+ "gitHead": "65a87d09da72ab1d4388b1b87bee753ff949a583"
50
50
  }