Download wp-calypso/apps/wpcom-block-editor/src/wpcom/utils.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 888 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/wpcom-block-editor/src/wpcom/utils.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/apps/wpcom-block-editor/src/wpcom/utils.ts
-
curl -L -o utils.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/apps/wpcom-block-editor/src/wpcom/utils.ts
888 Bytes
| import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis'; | |
| /** | |
| * Get unlock API from Gutenberg. | |
| * Sometimes Gutenberg doesn't allow you to re-register the module and throws an error. | |
| */ | |
| export const getUnlock = () => { | |
| /** | |
| * Sometimes Gutenberg doesn't allow you to re-register the module and throws an error. | |
| */ | |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| let unlock: ( object: any ) => any | undefined; | |
| try { | |
| unlock = __dangerousOptInToUnstableAPIsOnlyForCoreModules( | |
| 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', | |
| '@wordpress/edit-site' | |
| ).unlock; | |
| return unlock; | |
| } catch ( error ) { | |
| // eslint-disable-next-line no-console | |
| console.error( 'Error: Unable to get the unlock api. Reason: %s', error ); | |
| return undefined; | |
| } | |
| }; | |