diff options
Diffstat (limited to 'src/event.js')
-rw-r--r-- | src/event.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/event.js b/src/event.js new file mode 100644 index 0000000..6a9c3e3 --- /dev/null +++ b/src/event.js @@ -0,0 +1,15 @@ + +var eventTypes = ['click', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove']; + +// generate events +for (var i = eventTypes.length - 1; i >= 0; i--) { + var t = eventTypes[i]; + SVG.Element.prototype[t] = function(f) { + var e = this; + this.node['on' + t] = function() { + return f.apply(e, arguments); + }; + + return e; + }; +};
\ No newline at end of file |