neo.mjs 4.0.34 → 4.0.37
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
package/src/component/Base.mjs
CHANGED
|
@@ -753,9 +753,7 @@ class Base extends CoreBase {
|
|
|
753
753
|
* @protected
|
|
754
754
|
*/
|
|
755
755
|
beforeSetModel(value, oldValue) {
|
|
756
|
-
|
|
757
|
-
oldValue.destroy();
|
|
758
|
-
}
|
|
756
|
+
oldValue?.destroy();
|
|
759
757
|
|
|
760
758
|
if (value) {
|
|
761
759
|
let me = this,
|
|
@@ -852,12 +850,11 @@ class Base extends CoreBase {
|
|
|
852
850
|
|
|
853
851
|
me.domListeners = [];
|
|
854
852
|
|
|
855
|
-
me.controller
|
|
856
|
-
me.controller = null;
|
|
853
|
+
me.controller = null; // triggers destroy()
|
|
857
854
|
|
|
858
855
|
me.reference && me.getController()?.removeReference(me); // remove own reference from parent controllers
|
|
859
856
|
|
|
860
|
-
me.model
|
|
857
|
+
me.model = null; // triggers destroy()
|
|
861
858
|
|
|
862
859
|
me.bind && parentModel?.removeBindings(me.id);
|
|
863
860
|
|
package/src/controller/Base.mjs
CHANGED
|
@@ -36,6 +36,15 @@ class Base extends CoreBase {
|
|
|
36
36
|
HashHistory.on('change', this.onHashChange, this);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @param args
|
|
41
|
+
*/
|
|
42
|
+
destroy(...args) {
|
|
43
|
+
HashHistory.un('change', this.onHashChange, this);
|
|
44
|
+
|
|
45
|
+
super.destroy(...args);
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
/**
|
|
40
49
|
* Placeholder method which gets triggered when the hash inside the browser url changes
|
|
41
50
|
* @param {Object} value
|
package/src/core/Observable.mjs
CHANGED
|
@@ -111,7 +111,12 @@ class Observable extends Base {
|
|
|
111
111
|
eventConfig.fn = eventConfig.scope[eventConfig.fn];
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
// remove the listener, in case the scope no longer exists
|
|
115
|
+
if (eventConfig.scope && !eventConfig.scope.id) {
|
|
116
|
+
listeners[name].splice(i, 1);
|
|
117
|
+
} else {
|
|
118
|
+
eventConfig.fn.apply(eventConfig.scope || me, eventConfig.data ? args.concat(eventConfig.data) : args);
|
|
119
|
+
}
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
122
|
}
|