mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
Use JavaScript Optional chaining
This commit is contained in:
parent
d9bc435e2c
commit
732b6eb641
55 changed files with 169 additions and 199 deletions
|
|
@ -50,8 +50,7 @@ export class AbstractModel {
|
|||
// forEachObjectEntry(this, (key, value) => {
|
||||
forEachObjectValue(this, value => {
|
||||
/** clear CollectionModel */
|
||||
let arr = ko.isObservableArray(value) ? value() : value;
|
||||
arr && arr.onDestroy && arr.onDestroy();
|
||||
(ko.isObservableArray(value) ? value() : value)?.onDestroy?.();
|
||||
/** destroy ko.observable/ko.computed? */
|
||||
// dispose(value);
|
||||
/** clear object value */
|
||||
|
|
@ -76,7 +75,7 @@ export class AbstractModel {
|
|||
*/
|
||||
static reviveFromJson(json) {
|
||||
let obj = this.validJson(json) ? new this() : null;
|
||||
obj && obj.revivePropertiesFromJson(json);
|
||||
obj?.revivePropertiesFromJson(json);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue