@wordpress/core-data
Version:
Access to and manipulation of core WordPress entities.
42 lines (34 loc) • 680 B
text/typescript
/**
* WordPress dependencies
*/
import {
privateApis as syncPrivateApis,
type SyncManager,
} from '@wordpress/sync';
/**
* Internal dependencies
*/
import { unlock } from './lock-unlock';
const {
createSyncManager,
Delta,
CRDT_DOC_META_PERSISTENCE_KEY,
CRDT_RECORD_MAP_KEY,
LOCAL_EDITOR_ORIGIN,
retrySyncConnection,
} = unlock( syncPrivateApis );
export {
Delta,
CRDT_DOC_META_PERSISTENCE_KEY,
CRDT_RECORD_MAP_KEY,
LOCAL_EDITOR_ORIGIN,
retrySyncConnection,
};
let syncManager: SyncManager;
export function getSyncManager(): SyncManager | undefined {
if ( syncManager ) {
return syncManager;
}
syncManager = createSyncManager();
return syncManager;
}