New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Delete Value UI Bug #171
Changes from 6 commits
d6145cc
e624b07
1d04860
e8a0e73
8456ebb
094ad31
2515894
dda33f8
1f8da1e
f122a36
0208677
4768a6b
fd17180
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,29 +17,38 @@ export class ValueOperationEventService { | |
|
||
// Used in the listening component. | ||
// i.e. this.valueOperationEventSubscription = this._valueOperationEventService.on(Events.ValueAdded, () => doSomething()); | ||
on(event: Events, action: (newValue) => void): Subscription { | ||
on(event: Events, action: (newValue: any) => void): Subscription { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in fd17180 |
||
return this._subject$ | ||
.pipe( | ||
// Filter down based on event name to any events that are emitted out of the subject from the emit method below. | ||
filter((e: EmitEvent) => e.name === event), | ||
map((e: EmitEvent) => e.value) | ||
map((e: EmitEvent) => e.value), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the comma is not required |
||
) | ||
.subscribe(action); // Subscribe to the subject to get the data. | ||
} | ||
|
||
// Used in the emitting component. | ||
// i.e. this.valueOperationEventService.emit(new EmitEvent(Events.ValueAdded)); | ||
// i.e. this.valueOperationEventService.emit(new EmitEvent(Events.ValueAdded, new EventValues(new ReadValue())); | ||
emit(event: EmitEvent) { | ||
this._subject$.next(event); | ||
} | ||
} | ||
|
||
export class EmitEvent { | ||
constructor(public name: any, public value?: BaseValue) { } | ||
constructor(public name: any, public value?: EventValues) { } | ||
} | ||
|
||
// Possible events that can be emitted. | ||
export enum Events { | ||
ValueAdded, | ||
ValueDeleted | ||
ValueDeleted, | ||
ValueUpdated | ||
} | ||
|
||
/** | ||
* @param currentValue the current value | ||
* @param newValue value to update the current value with | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain why the current value would have to be updated with the new value? |
||
*/ | ||
export class EventValues { | ||
constructor(public currentValue: BaseValue, public newValue?: BaseValue) { } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a comment that this is necessary because the DOM element has been re-created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in 4768a6b