diff options
Diffstat (limited to 'README.md')
-rwxr-xr-x | README.md | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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) ``` |