keytops-game-framework 1.0.22 → 1.0.24

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.
@@ -34,6 +34,7 @@ export interface IView {
34
34
  removeView(view: IView, destroy?: boolean): void;
35
35
  setData(...data: any[]): void;
36
36
  close(...eventParams: any[]): void;
37
+ onClose(caller: any, listener: (...args: any[]) => void, once?: boolean, ...args: any[]): void;
37
38
  removeFromParent(destroy?: boolean): void;
38
39
  allDestroy(): void;
39
40
  /**
package/dist/index.js CHANGED
@@ -7750,6 +7750,10 @@ let View = View_1 = class View extends cc.Component {
7750
7750
  close(...closeEventParams) {
7751
7751
  this.removeFromParent(!this.config.cache, ...closeEventParams);
7752
7752
  }
7753
+ onClose(caller, listener, once = true, ...args) {
7754
+ const targetView = this.config.viewClassName || this.config.viewClass || View_1.type;
7755
+ viewManager.onViewClose(targetView, caller, listener, once, ...args);
7756
+ }
7753
7757
  /**
7754
7758
  * 从父级移除视图
7755
7759
  * @param destroy 是否销毁,默认为true
@@ -8262,7 +8266,7 @@ class ViewManager {
8262
8266
  this._viewOpenEventMap = this._viewOpenEventMap || new Map();
8263
8267
  this._viewOpenEventMap.set(listener, { event: "open", viewConfig: this._getViewConfig(targetView), caller, listener, once, args });
8264
8268
  this.offViewEvent("open", this, this._onViewOpen);
8265
- this.onViewEvent("open", this, this._onViewOpen);
8269
+ this.onViewEvent("open", this, this._onViewOpen, false);
8266
8270
  }
8267
8271
  _onViewOpen(viewName, ...args) {
8268
8272
  this._viewOpenEventMap.forEach((value, key) => {
@@ -8292,7 +8296,7 @@ class ViewManager {
8292
8296
  this._viewCloseEventMap = this._viewCloseEventMap || new Map();
8293
8297
  this._viewCloseEventMap.set(listener, { event: "close", viewConfig: this._getViewConfig(targetView), caller, listener, once, args });
8294
8298
  this.offViewEvent("close", this, this._onViewClose);
8295
- this.onViewEvent("close", this, this._onViewClose);
8299
+ this.onViewEvent("close", this, this._onViewClose, false);
8296
8300
  }
8297
8301
  /**
8298
8302
  * [快捷方式]移除视图关闭的事件监听
@@ -8318,7 +8322,7 @@ class ViewManager {
8318
8322
  * @param once 是否只监听对应视图关闭一次。
8319
8323
  * @param args 其他参数
8320
8324
  */
8321
- onViewEvent(event, caller, listener, once = false, ...args) {
8325
+ onViewEvent(event, caller, listener, once = true, ...args) {
8322
8326
  if (!this._viewEvent) {
8323
8327
  this._viewEvent = new EventDispatcher();
8324
8328
  }
@@ -137,6 +137,7 @@ export declare class View extends cc.Component implements IView {
137
137
  * @param closeEventParams 视图close事件的参数
138
138
  */
139
139
  close(...closeEventParams: any[]): void;
140
+ onClose(caller: any, listener: (...args: any[]) => void, once?: boolean, ...args: any[]): void;
140
141
  /**
141
142
  * 从父级移除视图
142
143
  * @param destroy 是否销毁,默认为true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keytops-game-framework",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "cocos creator game framework library",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",