How to use the @wordpress/compose.withGlobalEvents function in @wordpress/compose

To help you get started, we’ve selected a few @wordpress/compose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WordPress / gutenberg / packages / editor / src / components / post-locked-modal / index.js View on Github external
user: getPostLockUser(),
			postId: getCurrentPostId(),
			postLockUtils: getEditorSettings().postLockUtils,
			activePostLock: getActivePostLock(),
			postType: getPostType( getEditedPostAttribute( 'type' ) ),
		};
	} ),
	withDispatch( ( dispatch ) => {
		const { autosave, updatePostLock } = dispatch( 'core/editor' );
		return {
			autosave,
			updatePostLock,
		};
	} ),
	withInstanceId,
	withGlobalEvents( {
		beforeunload: 'releasePostLock',
	} )
)( PostLockedModal );