mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-01 03:27:52 +00:00 
			
		
		
		
	 12ee7e5d82
			
		
	
	12ee7e5d82
	
	
	
		
			
			* feat: Add `chatwoot:ready` event listener on window * Add specs * Rename customEventHelper.js -> CustomEventHelper.js
		
			
				
	
	
		
			16 lines
		
	
	
		
			411 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			411 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| export const createEvent = eventName => {
 | |
|   let event;
 | |
|   if (typeof window.CustomEvent === 'function') {
 | |
|     event = new CustomEvent(eventName);
 | |
|   } else {
 | |
|     event = document.createEvent('CustomEvent');
 | |
|     event.initCustomEvent(eventName, false, false, null);
 | |
|   }
 | |
|   return event;
 | |
| };
 | |
| 
 | |
| export const dispatchWindowEvent = eventName => {
 | |
|   const event = createEvent(eventName);
 | |
|   window.dispatchEvent(event);
 | |
| };
 |