-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extensibility: Refactor hooks to make them reusable for editor and co…
…mponents
- Loading branch information
Showing
11 changed files
with
70 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,15 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import createHooks from '@wordpress/hooks'; | ||
import { addFilter } from '@wordpress/utils'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import anchor from './anchor'; | ||
import customClassName from './custom-class-name'; | ||
|
||
const hooks = createHooks(); | ||
|
||
const { | ||
addAction, | ||
addFilter, | ||
removeAction, | ||
removeFilter, | ||
removeAllActions, | ||
removeAllFilters, | ||
doAction, | ||
applyFilters, | ||
doingAction, | ||
doingFilter, | ||
didAction, | ||
didFilter, | ||
hasAction, | ||
hasFilter, | ||
} = hooks; | ||
|
||
export { | ||
addAction, | ||
addFilter, | ||
removeAction, | ||
removeFilter, | ||
removeAllActions, | ||
removeAllFilters, | ||
doAction, | ||
applyFilters, | ||
doingAction, | ||
doingFilter, | ||
didAction, | ||
didFilter, | ||
hasAction, | ||
hasFilter, | ||
}; | ||
const hooks = { addFilter }; | ||
|
||
anchor( hooks ); | ||
customClassName( hooks ); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import createHooks from '@wordpress/hooks'; | ||
|
||
const hooks = createHooks(); | ||
|
||
const { | ||
addAction, | ||
addFilter, | ||
removeAction, | ||
removeFilter, | ||
removeAllActions, | ||
removeAllFilters, | ||
doAction, | ||
applyFilters, | ||
doingAction, | ||
doingFilter, | ||
didAction, | ||
didFilter, | ||
hasAction, | ||
hasFilter, | ||
} = hooks; | ||
|
||
export { | ||
addAction, | ||
addFilter, | ||
removeAction, | ||
removeFilter, | ||
removeAllActions, | ||
removeAllFilters, | ||
doAction, | ||
applyFilters, | ||
doingAction, | ||
doingFilter, | ||
didAction, | ||
didFilter, | ||
hasAction, | ||
hasFilter, | ||
}; |
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