Skip to content

Commit

Permalink
Use consistent method names in docstring examples
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Dec 22, 2022
1 parent cb11084 commit 8b5103c
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions packages/data/src/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,33 @@ export const { lock, unlock } =
*
* ```js
* // In the package exposing the private selectors:
*
* import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';
* export const { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules( /* ... *\/ );
*
* import { experiments as dataExperiments } from '@wordpress/data';
* const { registerPrivateActionsAndSelectors } = unlock( dataExperiments );
*
* const store = registerStore( 'my-store', { /* ... *\/ } );
* import { __experimentalHasContentRoleAttribute, ...selectors } from './store/selectors';
* import { __experimentalToggleFeature, ...actions } from './store/actions';
* const store = registerStore( 'my-store', { selectors, actions, /* ... *\/ } );
* registerPrivateActionsAndSelectors( store, {
* __experimentalAction: ( state ) => state.value,
* __experimentalToggleFeature
* }, {
* __experimentalSelector: ( state ) => state.value,
* __experimentalHasContentRoleAttribute
* } );
*
* // In the package using the private selectors:
* import { store as blockEditorStore } from '@wordpress/block-editor';
* unlock( registry.select( blockEditorStore ) ).__experimentalSelector();
* import { store as storeWithPrivateAPIs } from '@wordpress/package';
* unlock( registry.dispatch( storeWithPrivateAPIs ) ).__experimentalToggleFeature();
* unlock( registry.select( storeWithPrivateAPIs ) ).__experimentalHasContentRoleAttribute();
*
* // Or in a React component:
* useSelect( ( select ) => (
* unlock( select( blockEditorStore ) ).__experimentalSelector()
* ) );
* useDispatch( ( dispatch ) => {
* unlock( dispatch( blockEditorStore ) ).__experimentalAction()
* unlock( dispatch( storeWithPrivateAPIs ) ).__experimentalToggleFeature()
* } );
* useSelect( ( select ) => (
* unlock( select( storeWithPrivateAPIs ) ).__experimentalHasContentRoleAttribute()
* ) );
* ```
*
* @param {Object} store The store descriptor to register the private selectors on.
Expand All @@ -84,19 +86,8 @@ export function registerPrivateActionsAndSelectors(
* Only available to core packages. These APIs are not stable and may
* change without notice. Do not use outside of core.
*
* @example
*
* ```js
* import { unlock } from '../experiments';
* import { experiments as dataExperiments } from '@wordpress/data';
* const { registerPrivateSelectors } = unlock( dataExperiments );
*
* import { store as blockEditorStore } from './store';
* import { __unstableSelectionHasUnmergeableBlock } from './store/selectors';
* registerPrivateSelectors( store, {
* __experimentalHasContentRoleAttribute
* } );
* ```
* Available APIs:
* – registerPrivateActionsAndSelectors
*/
export const experiments = {};
lock( experiments, {
Expand Down

1 comment on commit 8b5103c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3758301696
📝 Reported issues:

Please sign in to comment.