Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the class-based modifiers to use the ember-modifier v3 API.
In summary
didInstall
,didReceiveArguments
,didUpdateArguments
have all been replaced with a singlemodify
hook. This hook gets called on initial install and whenever the args change.Modify
base class no longer providesthis.element
. Instead,element
is provided in themodify
hook, so the modifier implementation setsthis.element
there.Modify
base class no longer providesthis.args
. Instead, positional and named args are passed to themodify
hook. I updated the implementation to setthis._namedArgs
andthis._positionalArgs
so the rest of the code can use those where it used to usethis.args.named
andthis.args.positional
respectively.willDestroy
hook has been removed. Instead, the implementation registers a cleanup function in the modifier's constructor using@ember/destroyable
. I moved the code that was in thewillDestroy
hook into this cleanup function.I updated the ember-try scenarios and ci to include the last two LTS versions (4.4 and 4.8).
I also updated the
package.json
to drop^2.0.0
from theember-modifier
dependency. I guess this means if you merge this, it's a breaking change so maybe you'll need to bump the major version.Fixes #4