You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Returns an object with a `cancel` method, for cancelling the observer
28
-
29
33
> > #### **keypath** *`String`*
30
34
> > The [keypath](keypaths) to observe, or a group of space-separated keypaths. Any of the keys can be a `*` character, which is treated as a wildcard.
31
35
> > #### **callback** *`Function`*
@@ -40,9 +44,7 @@ See {{{createLink 'Observers'}}} for more detail.
40
44
41
45
42
46
> ### ractive.observe( map[, options ])
43
-
> Returns an object with a `cancel` method, for cancelling all observers
Copy file name to clipboardExpand all lines: docs/edge/ractive.on().md.hbs
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,20 @@ title: ractive.on()
3
3
---
4
4
Subscribe to {{{createLink'events overview''events'}}}.
5
5
6
+
> ### ractive.on - all versions
7
+
> Returns an `Object` with:
8
+
> * `cancel` method, which removes all listeners subscribed by the `on` call
9
+
> * `silence` method, which prevents the handlers from firing until they are resumed
10
+
> * `isSilenced` method, which returns true if the listener is currently silenced
11
+
> * `resume` method, which allows the handlers to fire until they are again silenced
12
+
6
13
> ### ractive.on( eventName, handler )
7
-
> Returns an `Object` with a `cancel` method, which removes the handler.
8
14
> > #### **eventName** *`String`*
9
15
> > The name of the event to subscribe to
10
16
> > #### **handler** *`Function`*
11
17
> > The function that will be called, with `ractive` as `this`. The arguments depend on the event. Returning `false` from the handler will stop propagation and prevent default of DOM events and cancel {{{createLink'event bubbling'}}}.
12
18
13
19
> ### ractive.on( obj )
14
-
> Returns an `Object` with a `cancel` method, which removes all handlers in the passed-in `obj`.
15
20
> > #### **obj** *`Object`*
16
21
> > An object with keys named for each event to subscribe to. The value at each key is the handler function for that event.
0 commit comments