File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export interface ComplexProcessorApi<TData> extends SubjectApi<TData> {
2121 */
2222export abstract class ComplexProcessor < TData > extends Subject < TData > implements ComplexProcessorApi < TData > {
2323 protected _processing : boolean = false ;
24+ protected _willReprocessAfter : boolean = false ;
2425 protected _active : boolean = true ;
2526
2627 public get processing ( ) : boolean {
@@ -80,7 +81,20 @@ export abstract class ComplexProcessor<TData> extends Subject<TData> implements
8081 return this . process ( this . lastInput , force ) ;
8182 }
8283
84+ /**
85+ * Disables automatic reprocessing within the provided method.
86+ */
87+ public reprocessAfter ( method : ( ) => void , force ?: boolean ) : TData {
88+ this . _willReprocessAfter = true ;
89+
90+ method ( ) ;
91+
92+ this . _willReprocessAfter = false ;
93+
94+ return this . reprocess ( force ) ;
95+ }
96+
8397 protected shouldProcess ( force : boolean = false ) : boolean {
84- return ! this . _processing && ( this . active || force ) ;
98+ return ! this . _willReprocessAfter && ! this . _processing && ( this . active || force ) ;
8599 }
86100}
You can’t perform that action at this time.
0 commit comments