mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Sieve: use Optional chaining operator
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
This commit is contained in:
parent
3a1046f215
commit
e1426b484e
6 changed files with 12 additions and 13 deletions
|
|
@ -46,14 +46,13 @@ export class AbstractModel {
|
|||
onDestroy() {
|
||||
/** dispose ko subscribables */
|
||||
this.disposables.forEach(disposable => {
|
||||
disposable && typeof disposable.dispose === 'function' && disposable.dispose();
|
||||
typeof disposable?.dispose === 'function' && disposable.dispose();
|
||||
});
|
||||
/** clear object entries */
|
||||
// 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 */
|
||||
|
|
@ -78,7 +77,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