-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: Adds controller lifecycle
reset
hook
- Loading branch information
John Cowen
committed
Dec 5, 2018
1 parent
6e1ecb7
commit 0788ea6
Showing
2 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Route from '@ember/routing/route'; | ||
/** | ||
* This initializer is very similar to: | ||
* https://github.com/kellyselden/ember-controller-lifecycle | ||
* | ||
* Why is this included here: | ||
* 1. Make sure lifecycle functions are functions, not just truthy. | ||
* 2. Right now we don't want a setup function (at least until we are definitely decided that we want one) | ||
* This is possibly a very personal opinion so it makes sense to just include this file here. | ||
*/ | ||
Route.reopen({ | ||
resetController(controller, exiting, transition) { | ||
this._super(...arguments); | ||
if (typeof controller.reset === 'function') { | ||
controller.reset(exiting); | ||
} | ||
}, | ||
}); | ||
export function initialize() {} | ||
|
||
export default { | ||
initialize, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters