diff --git a/HISTORY.md b/HISTORY.md index 775135e1..63236e0b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,9 +6,13 @@ http://visjs.org ### Timeline -- items can be dragged and removed. +- Items can be dragged and removed. - Implemented options `selectable`, `editable`. -- added events when dragging the custom time bar. +- Added events when dragging the custom time bar. + +### DataSet + +- Renamed functions `subscribe` and `unsubscribe` to `on` and `off` respectively. ## 2014-01-31, version 0.4.0 diff --git a/docs/dataset.html b/docs/dataset.html index e6e8310b..cbb2ec8f 100644 --- a/docs/dataset.html +++ b/docs/dataset.html @@ -62,8 +62,8 @@ data.add([ ]); // subscribe to any change in the DataSet -data.subscribe('*', function (event, params, senderId) { - console.log('event', event, params); +data.on('*', function (event, properties, senderId) { + console.log('event', event, properties); }); // update an existing item @@ -545,8 +545,8 @@ var items = data.get({
One can subscribe on changes in a DataSet.
- A subscription can be created using the method subscribe
,
- and removed with unsubscribe
.
+ A subscription can be created using the method on
,
+ and removed with off
.
@@ -554,8 +554,8 @@ var items = data.get({ var data = new vis.DataSet(); // subscribe to any change in the DataSet -data.subscribe('*', function (event, params, senderId) { - console.log('event:', event, 'params:', params, 'senderId:', senderId); +data.on('*', function (event, properties, senderId) { + console.log('event:', event, 'properties:', properties, 'senderId:', senderId); }); // add an item @@ -565,14 +565,14 @@ data.remove(1); // triggers an 'remove' event-
Subscribe to an event.
Syntax: -DataSet.subscribe(event, callback)+
DataSet.on(event, callback)Where:
Unsubscribe from an event.
Syntax: -DataSet.unsubscribe(event, callback)+
DataSet.off(event, callback)Where
event
and callback
correspond with the
-parameters used to subscribe to the event.
+parameters used to subscribe to the event.
-function (event, params, senderId) { +function (event, properties, senderId) { // handle the event });@@ -674,13 +674,13 @@ function (event, params, senderId) {
add
,
update
, and remove
,
- params
is always an object containing a property
+ properties
is always an object containing a property
items, which contains an array with the ids of the affected
items.