Download wp-calypso/client/lib/accept/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 713 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/accept/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/lib/accept/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/accept/index.js
713 Bytes
| import { createElement } from 'react'; | |
| import ReactDom from 'react-dom'; | |
| import AcceptDialog from './dialog'; | |
| export default function ( message, callback, confirmButtonText, cancelButtonText, options ) { | |
| let wrapper = document.createElement( 'div' ); | |
| document.body.appendChild( wrapper ); | |
| function onClose( result ) { | |
| if ( wrapper ) { | |
| ReactDom.unmountComponentAtNode( wrapper ); | |
| document.body.removeChild( wrapper ); | |
| wrapper = null; | |
| } | |
| if ( callback ) { | |
| callback( result ); | |
| } | |
| } | |
| ReactDom.render( | |
| createElement( AcceptDialog, { | |
| message: message, | |
| onClose: onClose, | |
| confirmButtonText: confirmButtonText, | |
| cancelButtonText: cancelButtonText, | |
| options, | |
| } ), | |
| wrapper | |
| ); | |
| } | |