diff --git a/Jakefile.js b/Jakefile.js
index 483716dd..0d568d52 100644
--- a/Jakefile.js
+++ b/Jakefile.js
@@ -54,7 +54,6 @@ task('build', {async: true}, function () {
'./src/shim.js',
'./src/util.js',
- './src/events.js',
'./src/DataSet.js',
'./src/DataView.js',
diff --git a/examples/graph/07_selections.html b/examples/graph/07_selections.html
index 98e44ade..cc0d8fe2 100644
--- a/examples/graph/07_selections.html
+++ b/examples/graph/07_selections.html
@@ -51,8 +51,8 @@
graph = new vis.Graph(container, data, options);
// add event listener
- graph.on('select', function(params) {
- document.getElementById('info').innerHTML += 'selection: ' + params.nodes + '
';
+ graph.on('select', function(properties) {
+ document.getElementById('info').innerHTML += 'selection: ' + JSON.stringify(properties) + '
';
});
// set initial selection (id's of some nodes)
diff --git a/src/events.js b/src/events.js
deleted file mode 100644
index 4676aded..00000000
--- a/src/events.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * Event listener (singleton)
- */
-// TODO: replace usage of the event listener for the EventBus
-var events = {
- 'listeners': [],
-
- /**
- * Find a single listener by its object
- * @param {Object} object
- * @return {Number} index -1 when not found
- */
- 'indexOf': function (object) {
- var listeners = this.listeners;
- for (var i = 0, iMax = this.listeners.length; i < iMax; i++) {
- var listener = listeners[i];
- if (listener && listener.object == object) {
- return i;
- }
- }
- return -1;
- },
-
- /**
- * Add an event listener
- * @param {Object} object
- * @param {String} event The name of an event, for example 'select'
- * @param {function} callback The callback method, called when the
- * event takes place
- */
- 'addListener': function (object, event, callback) {
- var index = this.indexOf(object);
- var listener = this.listeners[index];
- if (!listener) {
- listener = {
- 'object': object,
- 'events': {}
- };
- this.listeners.push(listener);
- }
-
- var callbacks = listener.events[event];
- if (!callbacks) {
- callbacks = [];
- listener.events[event] = callbacks;
- }
-
- // add the callback if it does not yet exist
- if (callbacks.indexOf(callback) == -1) {
- callbacks.push(callback);
- }
- },
-
- /**
- * Remove an event listener
- * @param {Object} object
- * @param {String} event The name of an event, for example 'select'
- * @param {function} callback The registered callback method
- */
- 'removeListener': function (object, event, callback) {
- var index = this.indexOf(object);
- var listener = this.listeners[index];
- if (listener) {
- var callbacks = listener.events[event];
- if (callbacks) {
- index = callbacks.indexOf(callback);
- if (index != -1) {
- callbacks.splice(index, 1);
- }
-
- // remove the array when empty
- if (callbacks.length == 0) {
- delete listener.events[event];
- }
- }
-
- // count the number of registered events. remove listener when empty
- var count = 0;
- var events = listener.events;
- for (var e in events) {
- if (events.hasOwnProperty(e)) {
- count++;
- }
- }
- if (count == 0) {
- delete this.listeners[index];
- }
- }
- },
-
- /**
- * Remove all registered event listeners
- */
- 'removeAllListeners': function () {
- this.listeners = [];
- },
-
- /**
- * Trigger an event. All registered event handlers will be called
- * @param {Object} object
- * @param {String} event
- * @param {Object} properties (optional)
- */
- 'trigger': function (object, event, properties) {
- var index = this.indexOf(object);
- var listener = this.listeners[index];
- if (listener) {
- var callbacks = listener.events[event];
- if (callbacks) {
- for (var i = 0, iMax = callbacks.length; i < iMax; i++) {
- callbacks[i](properties);
- }
- }
- }
- }
-};
diff --git a/src/module/exports.js b/src/module/exports.js
index ef4c8ac2..b53f3e5e 100644
--- a/src/module/exports.js
+++ b/src/module/exports.js
@@ -3,7 +3,6 @@
*/
var vis = {
util: util,
- events: events,
Controller: Controller,
DataSet: DataSet,