@shopify/polaris
Version:
Shopify’s admin product component library
23 lines (20 loc) • 787 B
JavaScript
import { useContext } from 'react';
import { EphemeralPresenceManagerContext } from './context.js';
function useEphemeralPresenceManager() {
const ephemeralPresenceManager = useContext(EphemeralPresenceManagerContext);
if (!ephemeralPresenceManager) {
throw new Error('No ephemeral presence manager was provided. Your application must be wrapped in an <AppProvider> component. See https://polaris.shopify.com/components/app-provider for implementation instructions.');
}
return ephemeralPresenceManager;
}
function useReadOnlyEphemeralPresenceManager() {
const {
presenceList,
presenceCounter
} = useEphemeralPresenceManager();
return {
presenceList,
presenceCounter
};
}
export { useEphemeralPresenceManager, useReadOnlyEphemeralPresenceManager };