actually we need a proper function

pull/12553/head
Rich Harris 2 years ago
parent 3558100bb5
commit 8a297150e9

@ -1139,16 +1139,20 @@ function serialize_event_handler(node, { state, visit }) {
handler = node.expression;
// Event handlers can be dynamic (source/store/prop/conditional etc)
const dynamic_handler = () => {
return b.arrow(
const dynamic_handler = () =>
b.function(
null,
[b.rest(b.id('$$args'))],
b.call(
b.member(/** @type {Expression} */ (visit(handler)), b.id('apply'), false, true),
b.this,
b.id('$$args')
)
b.block([
b.return(
b.call(
b.member(/** @type {Expression} */ (visit(handler)), b.id('apply'), false, true),
b.this,
b.id('$$args')
)
)
])
);
};
if (handler.type === 'Identifier' || handler.type === 'MemberExpression') {
const id = object(handler);

Loading…
Cancel
Save