summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-02-22 14:40:39 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-02-22 14:40:39 +0100
commit7e47015224e778aa1bac45346665f1854b1ce4dc (patch)
treeb875e8087042ee64993880686f5bb5633d383553
parent4b2e055187f2f33d14f9e7573ce34b9333b553a3 (diff)
downloadsvg.js-7e47015224e778aa1bac45346665f1854b1ce4dc.tar.gz
svg.js-7e47015224e778aa1bac45346665f1854b1ce4dc.zip
Added example in Readme about passing additional data to events
-rwxr-xr-xREADME.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/README.md b/README.md
index 698a0ab..9354932 100755
--- a/README.md
+++ b/README.md
@@ -2642,6 +2642,18 @@ function whenSomethingHappens() {
}
```
+You can also pass some data to the event:
+
+```javascript
+function whenSomethingHappens() {
+ rect.fire('my:event', {some:'data'})
+}
+
+rect.on('my:event', function(e) {
+ alert(e.detail.some) // outputs 'data'
+})
+```
+
_Important: always make sure you namespace your event to avoid conflicts. Preferably use something very specific. So `wicked:event` for example would be better than something generic like `svg:event`._
## Numbers