File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,14 +100,10 @@ class AnnotationStorage {
100100 this . resetModified ( ) ;
101101 }
102102
103- if ( typeof this . onAnnotationEditor === "function" ) {
104- for ( const value of this . #storage. values ( ) ) {
105- if ( value instanceof AnnotationEditor ) {
106- return ;
107- }
108- }
109- this . onAnnotationEditor ( null ) ;
103+ if ( this . #storage. values ( ) . some ( v => v instanceof AnnotationEditor ) ) {
104+ return ;
110105 }
106+ this . onAnnotationEditor ?. ( null ) ;
111107 }
112108
113109 /**
@@ -135,9 +131,7 @@ class AnnotationStorage {
135131
136132 if ( value instanceof AnnotationEditor ) {
137133 ( this . #editorsMap ||= new Map ( ) ) . set ( value . annotationElementId , value ) ;
138- if ( typeof this . onAnnotationEditor === "function" ) {
139- this . onAnnotationEditor ( value . constructor . _type ) ;
140- }
134+ this . onAnnotationEditor ?. ( value . constructor . _type ) ;
141135 }
142136 }
143137
@@ -157,18 +151,14 @@ class AnnotationStorage {
157151 #setModified( ) {
158152 if ( ! this . #modified) {
159153 this . #modified = true ;
160- if ( typeof this . onSetModified === "function" ) {
161- this . onSetModified ( ) ;
162- }
154+ this . onSetModified ?. ( ) ;
163155 }
164156 }
165157
166158 resetModified ( ) {
167159 if ( this . #modified) {
168160 this . #modified = false ;
169- if ( typeof this . onResetModified === "function" ) {
170- this . onResetModified ( ) ;
171- }
161+ this . onResetModified ?. ( ) ;
172162 }
173163 }
174164
You can’t perform that action at this time.
0 commit comments