File size: 478 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { createEventDispatcher } from "svelte";
export function createDispatcher() {
    const dispatch = createEventDispatcher();
    return (e) => {
        const { originalEvent } = e.detail;
        const { cancelable } = e;
        const type = originalEvent.type;
        const shouldContinue = dispatch(type, { originalEvent, currentTarget: originalEvent.currentTarget }, { cancelable });
        if (!shouldContinue) {
            e.preventDefault();
        }
    };
}