namirasoft-core 1.4.31 → 1.4.32

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,6 +1,4 @@
1
1
  export declare class SetTimeouService {
2
- private milliseconds;
3
2
  private last;
4
- constructor(milliseconds: number);
5
- setTimeoutIfNotCalledAgain(callback: () => void): void;
3
+ setTimeoutIfNotCalledAgain(callback: () => void, milliseconds: number): void;
6
4
  }
@@ -3,18 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SetTimeouService = void 0;
4
4
  const TimeOperation_1 = require("./TimeOperation");
5
5
  class SetTimeouService {
6
- constructor(milliseconds) {
6
+ constructor() {
7
7
  this.last = new Date();
8
- this.milliseconds = milliseconds;
9
8
  }
10
- setTimeoutIfNotCalledAgain(callback) {
11
- let l = TimeOperation_1.TimeOperation.millisecondsLater(this.milliseconds - 1, this.last);
9
+ setTimeoutIfNotCalledAgain(callback, milliseconds) {
10
+ let l = TimeOperation_1.TimeOperation.millisecondsLater(milliseconds - 1, this.last);
12
11
  if (this.last < l)
13
12
  this.last = l;
14
13
  setTimeout(() => {
15
14
  if (this.last < new Date())
16
15
  callback();
17
- }, this.milliseconds);
16
+ }, milliseconds);
18
17
  }
19
18
  }
20
19
  exports.SetTimeouService = SetTimeouService;
@@ -1 +1 @@
1
- {"version":3,"file":"SetTimeouService.js","sourceRoot":"","sources":["../src/SetTimeouService.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD,MAAa,gBAAgB;IAIzB,YAAY,YAAoB;QADxB,SAAI,GAAS,IAAI,IAAI,EAAE,CAAC;QAG5B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IACD,0BAA0B,CAAC,QAAoB;QAE3C,IAAI,CAAC,GAAG,6BAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC;YACb,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAClB,UAAU,CAAC,GAAG,EAAE;YAEZ,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE;gBACtB,QAAQ,EAAE,CAAC;QACnB,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;CACJ;AAnBD,4CAmBC"}
1
+ {"version":3,"file":"SetTimeouService.js","sourceRoot":"","sources":["../src/SetTimeouService.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD,MAAa,gBAAgB;IAA7B;QAEY,SAAI,GAAS,IAAI,IAAI,EAAE,CAAC;IAYpC,CAAC;IAXG,0BAA0B,CAAC,QAAoB,EAAE,YAAoB;QAEjE,IAAI,CAAC,GAAG,6BAAa,CAAC,iBAAiB,CAAC,YAAY,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACrE,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC;YACb,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAClB,UAAU,CAAC,GAAG,EAAE;YAEZ,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE;gBACtB,QAAQ,EAAE,CAAC;QACnB,CAAC,EAAE,YAAY,CAAC,CAAC;IACrB,CAAC;CACJ;AAdD,4CAcC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.31",
11
+ "version": "1.4.32",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
@@ -2,21 +2,16 @@ import { TimeOperation } from "./TimeOperation";
2
2
 
3
3
  export class SetTimeouService
4
4
  {
5
- private milliseconds: number;
6
5
  private last: Date = new Date();
7
- constructor(milliseconds: number)
6
+ setTimeoutIfNotCalledAgain(callback: () => void, milliseconds: number)
8
7
  {
9
- this.milliseconds = milliseconds;
10
- }
11
- setTimeoutIfNotCalledAgain(callback: () => void)
12
- {
13
- let l = TimeOperation.millisecondsLater(this.milliseconds - 1, this.last);
8
+ let l = TimeOperation.millisecondsLater(milliseconds - 1, this.last);
14
9
  if (this.last < l)
15
10
  this.last = l;
16
11
  setTimeout(() =>
17
12
  {
18
13
  if (this.last < new Date())
19
14
  callback();
20
- }, this.milliseconds);
15
+ }, milliseconds);
21
16
  }
22
17
  }