@superutils/promise 1.0.7 → 1.0.9

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/index.d.ts CHANGED
@@ -123,8 +123,12 @@ type DeferredAsyncOptions<ThisArg = unknown, DelayMs extends number = number> =
123
123
  } & Omit<ThrottleOptions, 'onError' | 'ThisArg' | 'tid'>) | ({
124
124
  /** Debounce/deferred duration in milliseconds */
125
125
  delayMs?: PositiveNumber<DelayMs>;
126
- throttle?: false | undefined;
127
- } & Omit<DeferredOptions, 'onError' | 'ThisArg' | 'tid'>));
126
+ throttle?: false;
127
+ } & Omit<DeferredOptions, 'onError' | 'ThisArg' | 'tid'>) | {
128
+ /** Sequential execution. All promises will be executed sequentially making sure there is no overlap. */
129
+ delayMs: 0;
130
+ throttle?: false;
131
+ });
128
132
  /** Determines what to do when deferred promise/function fails */
129
133
  declare enum ResolveError {
130
134
  /** Neither resolve nor reject the failed */
@@ -143,7 +147,7 @@ declare enum ResolveError {
143
147
  declare enum ResolveIgnored {
144
148
  /** Never resolve ignored promises. Caution: make sure this doesn't cause any memory leaks. */
145
149
  NEVER = "NEVER",
146
- /** (default) resolve with active promise result, the one that caused the current promise/callback to be ignored). */
150
+ /** (default) resolve with active promise result, the one that caused the current promise/callback to be ignored. */
147
151
  WITH_LAST = "WITH_LAST",
148
152
  /** resolve with `undefined` value */
149
153
  WITH_UNDEFINED = "WITH_UNDEFINED"
package/dist/index.js CHANGED
@@ -169,9 +169,14 @@ var ResolveIgnored = /* @__PURE__ */ ((ResolveIgnored2) => {
169
169
  })(ResolveIgnored || {});
170
170
 
171
171
  // src/deferred.ts
172
- function deferred(options) {
172
+ function deferred(options = {}) {
173
173
  const { defaults } = deferred;
174
- options = objCopy(defaults, options, [], "empty");
174
+ options = objCopy(
175
+ defaults,
176
+ options,
177
+ [],
178
+ "empty"
179
+ );
175
180
  let { onError, onIgnore, onResult } = options;
176
181
  const {
177
182
  delayMs,
@@ -251,7 +256,7 @@ function deferred(options) {
251
256
  return deferFn(execute2, delayMs, options);
252
257
  })();
253
258
  const deferredFunc = (promise) => {
254
- const id = Symbol("deferred-queue-item-id");
259
+ const id = /* @__PURE__ */ Symbol("deferred-queue-item-id");
255
260
  const qItem = new PromisEBase_default();
256
261
  qItem.getPromise = isFn2(promise) ? promise : () => promise;
257
262
  qItem.started = false;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "url": "https://github.com/alien45/superutils/issues"
5
5
  },
6
6
  "dependencies": {
7
- "@superutils/core": "^1.0.7"
7
+ "@superutils/core": "^1.0.8"
8
8
  },
9
9
  "description": "An extended Promise with extra features such as status tracking, deferred/throttled execution, timeout and retry mechanism.",
10
10
  "files": [
@@ -23,7 +23,7 @@
23
23
  "main": "dist/index.js",
24
24
  "name": "@superutils/promise",
25
25
  "peerDpendencies": {
26
- "@superutils/core": "^1.0.7"
26
+ "@superutils/core": "^1.0.8"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
@@ -43,5 +43,5 @@
43
43
  "sideEffects": false,
44
44
  "type": "module",
45
45
  "types": "dist/index.d.ts",
46
- "version": "1.0.7"
46
+ "version": "1.0.9"
47
47
  }