pull/4523/head
hontas 6 years ago
parent bab037e60e
commit 49bd6d4d6a

@ -273,9 +273,6 @@ export function toggle_class(element, name, toggle) {
} }
export function custom_event<T=any>(type: string, detail?: T) { export function custom_event<T=any>(type: string, detail?: T) {
// is compile target customElement?
// is event not a Svelte event?
// use new CustomEvent with bubbles/composed = true for non, svelte event
const e: CustomEvent<T> = document.createEvent('CustomEvent'); const e: CustomEvent<T> = document.createEvent('CustomEvent');
e.initCustomEvent(type, false, false, detail); e.initCustomEvent(type, false, false, detail);
return e; return e;
@ -319,4 +316,4 @@ export class HtmlTag {
d() { d() {
this.n.forEach(detach); this.n.forEach(detach);
} }
} }

@ -28,8 +28,6 @@ export function onDestroy(fn) {
} }
export function createEventDispatcher() { export function createEventDispatcher() {
// is compile target customElement?
// always dispatch!
const component = get_current_component(); const component = get_current_component();
return (type: string, detail?: any) => { return (type: string, detail?: any) => {
@ -63,4 +61,4 @@ export function bubble(component, event) {
if (callbacks) { if (callbacks) {
callbacks.slice().forEach(fn => fn(event)); callbacks.slice().forEach(fn => fn(event));
} }
} }
Loading…
Cancel
Save