ddan-js 2.5.7 → 2.5.8

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.
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const debounce_1 = require("./debounce");
4
- const throttle_1 = require("./throttle");
5
- const mutex_1 = require("./mutex");
3
+ const debounce_1 = require("./modules/debounce");
4
+ const throttle_1 = require("./modules/throttle");
5
+ const mutex_1 = require("./modules/mutex");
6
6
  const pipeTask_1 = require("../../class/pipeTask");
7
7
  const base_1 = require("./base");
8
- const polling_1 = require("./polling");
8
+ const polling_1 = require("./modules/polling");
9
9
  const hooker_1 = require("./hooker");
10
10
  const pipeline_1 = require("./modules/pipeline");
11
11
  /**
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const to_1 = require("../../util/to");
4
- const is_1 = require("../../util/is");
3
+ const to_1 = require("../../../util/to");
4
+ const is_1 = require("../../../util/is");
5
5
  const FUNC_ERROR_TEXT = 'Expected a function';
6
6
  const nativeMax = Math.max;
7
7
  const nativeMin = Math.min;
@@ -8,10 +8,10 @@ class DPipeline {
8
8
  constructor() {
9
9
  this.clear();
10
10
  }
11
- pipe(_task) {
11
+ pipe(func) {
12
12
  if (this.__waitting)
13
13
  return this;
14
- _task && this.__list.push(_task);
14
+ func && this.__list.push(func);
15
15
  this._step();
16
16
  return this;
17
17
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const base_1 = require("./base");
3
+ const base_1 = require("../base");
4
4
  async function polling(params = {}) {
5
5
  const { func, interval = 100, times = 1000 } = params;
6
6
  let _times = times;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const is_1 = require("../../util/is");
3
+ const is_1 = require("../../../util/is");
4
4
  const debounce_1 = require("./debounce");
5
5
  /** Error message constants. */
6
6
  const FUNC_ERROR_TEXT = 'Expected a function';
@@ -187,13 +187,13 @@ declare const dUtil: {
187
187
  declare const dHook: {
188
188
  sleep: (ms?: number) => Promise<unknown>;
189
189
  run: <T = any>(task?: import("./typings").Ddan.PFunction<T> | undefined, wait?: number) => Promise<[any, undefined] | [null, T]>;
190
- exec: (func: import("./typings").Ddan.PFunction<any>, taskId?: string) => import("./typings").Ddan.SafeResult<any>;
191
- debounce: typeof import("./modules/hook/debounce").default;
192
- throttle: typeof import("./modules/hook/throttle").default;
190
+ exec: (func: import("./typings").Ddan.Function, taskId?: string) => import("./typings").Ddan.SafeResult<any>;
191
+ debounce: typeof import("./modules/hook/modules/debounce").default;
192
+ throttle: typeof import("./modules/hook/modules/throttle").default;
193
193
  task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
194
- mutex: typeof import("./modules/hook/mutex").default;
195
- polling: typeof import("./modules/hook/polling").default;
196
- pipe: (func: import("./typings").Ddan.PFunction<any>) => import("./modules/hook/modules/pipeline").default;
194
+ mutex: typeof import("./modules/hook/modules/mutex").default;
195
+ polling: typeof import("./modules/hook/modules/polling").default;
196
+ pipe: (func: import("./typings").Ddan.Function) => import("./modules/hook/modules/pipeline").default;
197
197
  pipeline: () => import("./modules/hook/modules/pipeline").default;
198
198
  to: <T_1 = any, U extends object = any>(promise: Promise<T_1>, errorExt?: object | undefined) => Promise<[null, T_1] | [U, undefined]>;
199
199
  go: <T_2 = any>(task?: import("./typings").Ddan.PFunction<T_2> | undefined) => Promise<[any, undefined] | [null, T_2]>;
@@ -472,13 +472,13 @@ declare const _default: {
472
472
  hook: {
473
473
  sleep: (ms?: number) => Promise<unknown>;
474
474
  run: <T = any>(task?: import("./typings").Ddan.PFunction<T> | undefined, wait?: number) => Promise<[any, undefined] | [null, T]>;
475
- exec: (func: import("./typings").Ddan.PFunction<any>, taskId?: string) => import("./typings").Ddan.SafeResult<any>;
476
- debounce: typeof import("./modules/hook/debounce").default;
477
- throttle: typeof import("./modules/hook/throttle").default;
475
+ exec: (func: import("./typings").Ddan.Function, taskId?: string) => import("./typings").Ddan.SafeResult<any>;
476
+ debounce: typeof import("./modules/hook/modules/debounce").default;
477
+ throttle: typeof import("./modules/hook/modules/throttle").default;
478
478
  task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
479
- mutex: typeof import("./modules/hook/mutex").default;
480
- polling: typeof import("./modules/hook/polling").default;
481
- pipe: (func: import("./typings").Ddan.PFunction<any>) => import("./modules/hook/modules/pipeline").default;
479
+ mutex: typeof import("./modules/hook/modules/mutex").default;
480
+ polling: typeof import("./modules/hook/modules/polling").default;
481
+ pipe: (func: import("./typings").Ddan.Function) => import("./modules/hook/modules/pipeline").default;
482
482
  pipeline: () => import("./modules/hook/modules/pipeline").default;
483
483
  to: <T_1 = any, U extends object = any>(promise: Promise<T_1>, errorExt?: object | undefined) => Promise<[null, T_1] | [U, undefined]>;
484
484
  go: <T_2 = any>(task?: import("./typings").Ddan.PFunction<T_2> | undefined) => Promise<[any, undefined] | [null, T_2]>;
@@ -1,9 +1,9 @@
1
1
  import { Ddan } from '../../typings';
2
- import debounce from './debounce';
3
- import throttle from './throttle';
4
- import mutex from './mutex';
2
+ import debounce from './modules/debounce';
3
+ import throttle from './modules/throttle';
4
+ import mutex from './modules/mutex';
5
5
  import DPipeTask from '../../class/pipeTask';
6
- import polling from './polling';
6
+ import polling from './modules/polling';
7
7
  import DPipeline from './modules/pipeline';
8
8
  /**
9
9
  *
@@ -15,13 +15,13 @@ declare function run<T = any>(task?: Ddan.PFunction<T>, wait?: number): Promise<
15
15
  declare const _default: {
16
16
  sleep: (ms?: number) => Promise<unknown>;
17
17
  run: typeof run;
18
- exec: (func: Ddan.PFunction<any>, taskId?: string) => Ddan.SafeResult<any>;
18
+ exec: (func: Ddan.Function, taskId?: string) => Ddan.SafeResult<any>;
19
19
  debounce: typeof debounce;
20
20
  throttle: typeof throttle;
21
21
  task: (param?: Ddan.Func1<any, any> | undefined) => DPipeTask;
22
22
  mutex: typeof mutex;
23
23
  polling: typeof polling;
24
- pipe: (func: Ddan.PFunction<any>) => DPipeline;
24
+ pipe: (func: Ddan.Function) => DPipeline;
25
25
  pipeline: () => DPipeline;
26
26
  to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
27
27
  go: <T_1 = any>(task?: Ddan.PFunction<T_1> | undefined) => Promise<[any, undefined] | [null, T_1]>;
@@ -1,4 +1,4 @@
1
- import { Ddan } from '../../typings';
1
+ import { Ddan } from '../../../typings';
2
2
  /**
3
3
  * 防抖 一段时间内,规定时间间隔多次执行,回调触发一次
4
4
  * @param func
@@ -1,3 +1,3 @@
1
- import { Ddan } from "../../typings";
1
+ import { Ddan } from "../../../typings";
2
2
  declare function mutex(func: Ddan.Action): (...args: any[]) => Promise<false | undefined>;
3
3
  export default mutex;
@@ -1,10 +1,10 @@
1
1
  import { Ddan } from '../../../typings';
2
2
  export default class DPipeline implements Ddan.IPipeline {
3
- __list: Ddan.PFunction[];
3
+ __list: Ddan.Function[];
4
4
  __running: boolean;
5
5
  __waitting: boolean;
6
6
  constructor();
7
- pipe(_task?: Ddan.PFunction): this;
7
+ pipe(func?: Ddan.Function): this;
8
8
  delay(t?: number): this;
9
9
  clear(): this;
10
10
  _step(): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { Ddan } from "../../typings";
1
+ import { Ddan } from "../../../typings";
2
2
  declare function polling(params?: {
3
3
  func?: Ddan.Func<Ddan.Result<Boolean | void>>;
4
4
  interval?: number;
@@ -1,4 +1,4 @@
1
- import { Ddan } from "../../typings";
1
+ import { Ddan } from "../../../typings";
2
2
  /**
3
3
  * 节流 每个间隔内,触发一次
4
4
  * @param func
@@ -145,7 +145,7 @@ export declare namespace Ddan {
145
145
  trailing?: boolean;
146
146
  }
147
147
  interface IPipeline {
148
- pipe(func?: any): IPipeline;
148
+ pipe(func?: Function): IPipeline;
149
149
  delay(t?: number): IPipeline;
150
150
  clear(): IPipeline;
151
151
  whenAll(): Promise<IPipeline>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddan-js",
3
- "version": "2.5.7",
3
+ "version": "2.5.8",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "ddan-js",