-
-
Save jorroll/ec43f8c702354b925a0e8a04b9be7364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FormControl<Value = any, Data = any> | |
implements AbstractControl<Value, Data> { | |
id: ControlId; | |
constructor() { | |
this.source | |
.pipe( | |
filter( | |
// make sure we don't process an event we already processed | |
event => !event.processed.includes(this.id), | |
), | |
) | |
.subscribe(event => { | |
event.processed.push(this.id); | |
if (!event.meta) event.meta = {}; | |
if (!event.id) event.id = AbstractControl.eventId(); | |
const newEvent = this.processEvent(event as ControlEvent); | |
if (newEvent) { | |
this._events.next(newEvent); | |
} | |
}); | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment