fix event context

pull/1864/head
Rich Harris 7 years ago
parent f13c2272df
commit 880702d961

@ -30,7 +30,9 @@ export function createEventDispatcher() {
// TODO are there situations where events could be dispatched // TODO are there situations where events could be dispatched
// in a server (non-DOM) environment? // in a server (non-DOM) environment?
const event = new window.CustomEvent(type, { detail }); const event = new window.CustomEvent(type, { detail });
callbacks.slice().forEach(fn => fn(event)); callbacks.slice().forEach(fn => {
fn.call(component, event);
});
} }
}; };
} }

Loading…
Cancel
Save