-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide context object as an argument in lifecycle hooks (#2090)
To help improve the API of lifecycle hooks, this PR updates arguments so that there is always a "context" object provided as the argument. This removes the need to call methods using `call(this)` or `bind(this)` since whatever you expect `this` to be, it can be more explicitly accessed via the context object. This takes the following form depending on which hook is being run: ```js { parent, entry, plugin } ``` - Parent: this is the root component class (Modal, Drawer, Popover, etc). It is always provided to all lifecycle hook calls. - Entry: this is the current entry object being acted upon. This is provided only when an entry context is available, e.g: `onMount`, `beforeRegister`, `afterRegister`. - Plugin: this is the plugin object that is running the hook. For example, any hook or `onChange` callbacks will have this context available. **Additional changes** - `maybeRunMethod` has been refactored to no longer set `this`, but instead takes an `obj` argument. - `debug` has been expanded to provide more control and information of log output. - `condition` options in both `propStore` and `debug` can now either be a boolean value or a function that returns a boolean.
- Loading branch information
Showing
17 changed files
with
138 additions
and
109 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
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
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
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
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
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
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
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
Oops, something went wrong.