Skip to content

Commit

Permalink
createManager function
Browse files Browse the repository at this point in the history
  • Loading branch information
chadhietala committed Oct 5, 2018
1 parent 53430fe commit a93c48f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions text/0000-Element-Modifier-Managers.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,25 @@ class:
// my-app/app/modifier/foo.js

import EmberObject from '@ember/object';
import Basic from './basic-manager';
import { createManager } from './basic-manager';
import { setModifierManager } from '@ember/modifier';

export default setModifierManager(Basic, EmberObject.extend({
export default setModifierManager(createManager, EmberObject.extend({
// ...
}));
```

This tells Ember to use the `Basic` manager for
the `foo` element modifier. `setModifierManager` function returns the class.
```js
// my-app/app/modifier/basic-manager.js

// ...

export function createManager(owner) {
return new BasicManager(owner);
}
```

`setModifierManager` takes two parameters. The first parameter is a function that takes an `Owner` and returns an instance of a manager. The second parameter is the base class that applications would extend from.

In reality, an app developer would never have to write this in their apps,
since the modifier manager would already be assigned on a super-class provided
Expand Down

0 comments on commit a93c48f

Please sign in to comment.