Fusion icon indicating copy to clipboard operation
Fusion copied to clipboard

Add state handlers for OnChange, OnEvent, etc.

Open krypt102 opened this issue 3 years ago • 2 comments

Fixes #109 This will allow for state objects to be used for Change and Event callbacks.

krypt102 avatar Feb 07 '23 23:02 krypt102

Is this designed enough yet? The original issue mentions the gain to be "avoiding unnecessary memory from an unused connection", but this implementation does not accomplish that. This implementation also breaks when the state result is nil, as was given as a usecase in the original issue.

In general, the concept of using a state to switch between different callbacks does not seem so intuitive to me. Especially with no performance/memory gain, code readability would be improved by just using a regular callback that performs the logic when the event is called.

Dionysusnu avatar Feb 10 '23 08:02 Dionysusnu

This implementation also breaks when the state result is nil, as was given as a usecase in the original issue.

Didn't realise this! Will update!

"avoiding unnecessary memory from an unused connection", but this implementation does not accomplish that.

Mind elaborating? My mind is a bit off today haha

krypt102 avatar Feb 10 '23 13:02 krypt102

Closing this PR due to a lack of motion. I'll be happy to merge a more up-to-date variant.

dphfox avatar Apr 15 '24 12:04 dphfox