You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defpublish(e: Event) { for (l <- listeners) l(e) }
and Reactions.Impl.apply
defapply(e: Event) {
for (p <- parts) if (p isDefinedAt e) p(e)
}
This means that if we have the following code
vall:Reaction= {
caseButtonClicked(b) => println("Button pushed")
}
// This should work, or not be available in the API ;)
button.subscribe(l)
// This works
button.reactions += l
it will give lots of MatchErrors (e.g. when FocusGained/FocusLost events are fired) if we add the listener with the first construct, whereas it works fine in the second construct.
(Actually, why are there two different ways of adding listeners in the first place?)
The text was updated successfully, but these errors were encountered:
Compare Publisher.publish
and Reactions.Impl.apply
This means that if we have the following code
it will give lots of MatchErrors (e.g. when FocusGained/FocusLost events are fired) if we add the listener with the first construct, whereas it works fine in the second construct.
(Actually, why are there two different ways of adding listeners in the first place?)
The text was updated successfully, but these errors were encountered: