diff options
Diffstat (limited to 'src/event.js')
-rwxr-xr-x | src/event.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/event.js b/src/event.js index 8430fa0..6108155 100755 --- a/src/event.js +++ b/src/event.js @@ -34,7 +34,7 @@ SVG.listeners = {} // Event constructor SVG.registerEvent = function(event) { if (!SVG.events[event]) - SVG.events[event] = new Event(event) + SVG.events[event] = new CustomEvent(event) } // Add event binder in the SVG namespace @@ -65,9 +65,16 @@ SVG.extend(SVG.Element, { return this } // Fire given event -, fire: function(event) { +, fire: function(event, data) { + // Add detail data to event + SVG.events[event].detail = data + + // Dispatch event this.node.dispatchEvent(SVG.events[event]) + // Remove detail + delete SVG.events[event].detail + return this } })
\ No newline at end of file |