summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-06-17 15:55:32 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-06-17 15:55:32 +0200
commit0d6459729c2508d2631894b004d74961fe99d334 (patch)
treee8b2ec0b40c48f72e385efc8b2f8c29cdd2c20f4 /README.md
parent71c984a986e1c0980ce0a6eb5626dda989cfa428 (diff)
downloadsvg.js-0d6459729c2508d2631894b004d74961fe99d334.tar.gz
svg.js-0d6459729c2508d2631894b004d74961fe99d334.zip
Events, Spec update, readme
Events can now be detached with only specifying the namespace (`el.off('.namespace')`) `el.fire()` now accepts event-objects as parameter (like mouseevents)
Diffstat (limited to 'README.md')
-rwxr-xr-xREADME.md11
1 files changed, 10 insertions, 1 deletions
diff --git a/README.md b/README.md
index 9c421a2..63f1d0b 100755
--- a/README.md
+++ b/README.md
@@ -2913,6 +2913,12 @@ Now you are ready to fire the event whenever you need:
function whenSomethingHappens() {
rect.fire('myevent')
}
+
+// or if you want to pass an event
+function whenSomethingHappens(event) {
+ rect.fire(event)
+}
+
```
You can also pass some data to the event:
@@ -2937,9 +2943,12 @@ rect.on('myevent.namespace', function(e) {
// do something
})
-// detach all handlers of namespace
+// detach all handlers of namespace for myevent
rect.off('myevent.namespace')
+// detach all handlers of namespace
+rect.off('.namespace')
+
// detach all handlers including all namespaces
rect.off('myevent)
```