Skip to content

Commit

Permalink
Namespace actions
Browse files Browse the repository at this point in the history
  • Loading branch information
josephfusco committed Sep 9, 2024
1 parent 826f390 commit ac4f65c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
9 changes: 7 additions & 2 deletions ACTIONS_AND_FILTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@

## JavaScript Actions

- `wpgraphqlide_destroyed`
- `wpgraphqlide_rendered` ([graphiql_rendered](https://www.wpgraphql.com/docs/customizing-wpgraphiql#graphiql_rendered))
- `wpgraphql-ide.init`
- `wpgraphql-ide.rendered` ([graphiql_rendered](https://www.wpgraphql.com/docs/customizing-wpgraphiql#graphiql_rendered))
- `wpgraphql-ide.destroyed`
- `wpgraphql-ide.afterRegisterToolbarButton`
- `wpgraphql-ide.registerToolbarButtonError`
- `wpgraphql-ide.afterRegisterActivityBarPanel`
- `wpgraphql-ide.registerActivityBarPanelError`

## JavaScript Filters

Expand Down
12 changes: 6 additions & 6 deletions src/access-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export function registerDocumentEditorToolbarButton(
config,
priority
);
hooks.doAction( 'afterRegisterToolbarButton', name, config, priority );
hooks.doAction( 'wpgraphql-ide.afterRegisterToolbarButton', name, config, priority );
} catch ( error ) {
console.error( `Failed to register button: ${ name }`, error );
hooks.doAction(
'registerToolbarButtonError',
'wpgraphql-ide.registerToolbarButtonError',
name,
config,
priority,
Expand All @@ -42,7 +42,7 @@ export function registerActivityBarPanel( name, config, priority = 10 ) {
priority
);
hooks.doAction(
'afterRegisterActivityBarPanel',
'wpgraphql-ide.afterRegisterActivityBarPanel',
name,
config,
priority
Expand All @@ -53,7 +53,7 @@ export function registerActivityBarPanel( name, config, priority = 10 ) {
error
);
hooks.doAction(
'registerActivityBarPanelError',
'wpgraphql-ide.registerActivityBarPanelError',
name,
config,
priority,
Expand All @@ -74,15 +74,15 @@ export function registerActivityBarPanel( name, config, priority = 10 ) {
// priority
// );
// hooks.doAction(
// 'afterRegisterActivityBarUtilityButton',
// 'wpgraphql-ide.afterRegisterActivityBarUtilityButton',
// name,
// config,
// priority
// );
// } catch ( error ) {
// console.error( `Failed to register button: ${ name }`, error );
// hooks.doAction(
// 'registerActivityBarUtilityButtonError',
// 'wpgraphql-ide.registerActivityBarUtilityButtonError',
// name,
// config,
// priority,
Expand Down
8 changes: 4 additions & 4 deletions src/components/AppWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ export function AppWrapper() {
/**
* Perform actions on component mount.
*
* Triggers a custom action 'wpgraphqlide_rendered' when the App component mounts,
* Triggers a custom action 'wpgraphql-ide.rendered' when the App component mounts,
* allowing plugins or themes to hook into this event. The action passes
* the current state of `drawerOpen` to any listeners, providing context
* about the application's UI state.
*/
doAction( 'wpgraphqlide_rendered' );
doAction( 'wpgraphql-ide.rendered' );

/**
* Cleanup action on component unmount.
*
* Returns a cleanup function that triggers the 'wpgraphqlide_destroyed' action,
* Returns a cleanup function that triggers the 'wpgraphql-ide.destroyed' action,
* signaling that the App component is about to unmount. This allows for
* any necessary cleanup or teardown operations in response to the App
* component's lifecycle.
*/
return () => doAction( 'wpgraphqlide_destroyed' );
return () => doAction( 'wpgraphql-ide.destroyed' );
}, [] );

return <RenderAppWrapper />;
Expand Down

0 comments on commit ac4f65c

Please sign in to comment.