Skip to content

Commit

Permalink
md
Browse files Browse the repository at this point in the history
  • Loading branch information
PS committed Nov 19, 2024
1 parent 5a5493c commit c54e3e8
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions docs/basic-features/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,6 @@ way to propagate event in other directions, or to other parts of the UI, or
from the controller to the UI is using the `app/event/Dispatcher` API.

**Accessing Dispatcher in Controllers** is easy with [Dependency Injection](./object-container.md#1-dependency-injection).
**To access Dispatcher from Views and Components** you should register it in [ComponentUtils](./views-and-components.md#utilities-shared-across-views-and-components).

```javascript
// app/config/bind.js
import { Dispatcher } from '@ima/core';

export let init = (ns, oc, config) => {
const ComponentUtils = oc.get('$ComponentUtils');

ComponentUtils.register({
$Dispatcher: Dispatcher
});
}
```


### Firing and listening to Dispatcher events
Expand Down Expand Up @@ -222,21 +208,7 @@ The `Observable` class allows you to subscribe to events dispatched by the
`Dispatcher`. Upon subscribing, subscribers will be notified of past and future
events.

**Accessing Observable in Controllers** is easy with [Dependency Injection](./object-container.md#1-dependency-injection).
**To access Observable from Views and Components** you should register it in [ComponentUtils](./views-and-components.md#utilities-shared-across-views-and-components).

```javascript
// app/config/bind.js
import { Observable } from '@ima/core';

export let init = (ns, oc, config) => {
const ComponentUtils = oc.get('$ComponentUtils');

ComponentUtils.register({
$Observable: Observable
});
}
```
**Accessing Observable in Controllers** is easy with [Dependency Injection](./object-container.md#1-dependency-injection).

### Subscribing and unsubscribing to events

Expand Down

0 comments on commit c54e3e8

Please sign in to comment.