Given that there is more than one listener that registers later in time than the first he might not get a full diff to his own state (which is e.g. null). Therefore store the last state of all individual listeners and calculate the changes based on this information rather than storing one last state for all of the listeners.
Given that there is more than one listener that registers later in time than the first he might not get a full diff to his own state (which is e.g. null). Therefore store the last state of all individual listeners and calculate the changes based on this information rather than storing one last state for all of the listeners.
This is analogue to the same problem solved in the DOMObserver class of itm-utils. See https://github.com/itm/itm-utils/issues/27 for the implementation.