Pass context from beforeChange to change?

#1

Is there any way to pass context (i.e. a value/object) from the beforeChange event handler to the change event handler?

There is processing I must do at the beforeChange stage, in case the change needs to be cancelled, and processing I must do at the change stage, because I need the edit to actually be done first, even if it’s not rendered yet. Some cases are very difficult to do well without being able to pass data from the beforeChange event handler to the change event handler though.

The only definite way I can think of solving some cases, which doesn’t make assumptions I can’t know might not be true sometimes, is for the change event handler to reconstruct the original content from the current content and the change data, repeat processing that the beforeChange handler did, in order to effectively reconstruct the context that I would like to have just passed on… before now doing whatever needs to be done. It’s a bit inefficient though.

#2

The library won’t do this, but you should be able to store the information somewhere and reuse it, if you make sure you invalidate it and/or use the appropriate values as cache keys.

#3

Ok, fair enough, thanks for the reply.