overcentric
Version:
Overcentric watches your website, product, and users - and tells you what matters and what to do about it.
30 lines (29 loc) • 912 B
JavaScript
let loadPromise = null;
export async function loadAutoCapture() {
try {
if (!loadPromise) {
loadPromise = import('../autoCapture')
.then(({ startAutoCapture }) => ({ startAutoCapture }))
.catch(error => {
loadPromise = null;
throw new Error(`Failed to load auto-capture module: ${error.message}`);
});
}
return loadPromise;
}
catch (error) {
loadPromise = null;
throw error;
}
}
export async function initAutoCapture(trackEvent, config) {
try {
const { startAutoCapture } = await loadAutoCapture();
startAutoCapture(trackEvent, config);
console.log('Overcentric: Auto-capture initialized successfully');
}
catch (error) {
console.error('Overcentric: Failed to initialize auto-capture:', error);
throw error;
}
}