DmitryBaranovskiy/raphael — pull request #723 by keyneom (2013-05-04 19:26:53+00:00)
Title: New Function "dataset" and updated Events for setting data

First, there is now a dataset function that allows you to retrieve and set values for multiple data keys all at once. If it is called with no parameters it returns an object of all key:value pairings for the element.

E.g.
workShift.dataset() -- returns all data key:value pairings for the element
workShift.dataset( ['startOfShift', 'endOfShift'] ) -- returns an object with the key:value pairings for the start of the shift and for teh end of the shift
workShift.dataset( { 'typeOfShift': 'supervisor', 'employee': 'John Doe' } ) -- sets the data for each key:value pairing

Second, when setting or getting data the events now include which key is being interacted with.

E.g. You have a circle in a graph that has a radius in direct proportion to the number of people living in a city. The x-axis might be the longitude of the city and the y-axis could be the latitude. The radius of the circle gives an idea of how large the city is. When adjusting the number of people living in the city, it would be easy to have a population data value that when set would adjust the size of the circle. You can now use eve.on('*.data.set.*.population', updateRadius) to listen for any changes to the population and then update the radius of your circle to reflect the new population size.