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

Loading…
Cancel
Save