@4i/modal-manager 1.0.30 → 1.0.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4i/modal-manager",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -19,6 +19,10 @@ npm install @4i/modal-manager
19
19
 
20
20
  create table with methods
21
21
 
22
+ onOpenModalState(callback: (state: boolean) => void) {
23
+ callback(this.queue.length > 0);
24
+ }
25
+
22
26
  | Method | Description |
23
27
  | ------------------------------------ | ----------------------------------------------------- |
24
28
  | call(action, props) | Call a modal by its action name and pass props to it. |
@@ -31,7 +35,7 @@ create table with methods
31
35
  | |
32
36
  | close() | Close last modals. (default) |
33
37
  | |
34
- | haveOpenModal | (getter) Is there at least one window open now |
38
+ | onOpenModalState(callback) | Is there at least one window open now |
35
39
  | |
36
40
  | addEventListener(event, callback) | Add an event listener to the modal manager. |
37
41
  | |
@@ -8,7 +8,7 @@ declare class ModalManager extends Manager {
8
8
  }): void;
9
9
  call<T>(name: string, data?: T): void;
10
10
  close<T>(position?: T): void;
11
- get haveOpenModal(): boolean;
11
+ onOpenModalState(callback: (state: boolean) => void): void;
12
12
  }
13
13
  declare const modal: ModalManager;
14
14
  export default modal;
@@ -49,13 +49,9 @@ var ModalManager = /** @class */ (function (_super) {
49
49
  this.emitter.emit(constants.CLOSE, position);
50
50
  this.queue.pop();
51
51
  };
52
- Object.defineProperty(ModalManager.prototype, "haveOpenModal", {
53
- get: function () {
54
- return this.queue.length > 0;
55
- },
56
- enumerable: false,
57
- configurable: true
58
- });
52
+ ModalManager.prototype.onOpenModalState = function (callback) {
53
+ callback(this.queue.length > 0);
54
+ };
59
55
  return ModalManager;
60
56
  }(Manager_1.default));
61
57
  var modal = new ModalManager();
@@ -35,8 +35,8 @@ class ModalManager extends Manager {
35
35
  this.queue.pop();
36
36
  }
37
37
 
38
- get haveOpenModal() {
39
- return this.queue.length > 0;
38
+ onOpenModalState(callback: (state: boolean) => void) {
39
+ callback(this.queue.length > 0);
40
40
  }
41
41
  }
42
42